﻿using SRB.Tg.DrawingStandard;
using SRB.Tg.Operate;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Teigha.DatabaseServices;
using Teigha.Geometry;

namespace SRB.Tg.Model
{
    public class PierRebar
    {
        PierPara pierPara;
        //string strDiameter = "%%130";
        string strDiameter = "A";
        string strMainDiameter = "A";
        //List<double> spanBeamLst = new List<double>(); //盖梁部分钢筋分布
        //List<double> spanPileCapLst = new List<double>(); //承台部分钢筋分布

        List<double> spancwLst = new List<double>();  //横桥向截面分布
        List<double> spancsLst = new List<double>();
        List<double> spancaLst = new List<double>();
        List<double> spancmLst = new List<double>();

        List<double> spanclLst = new List<double>();  //顺桥向截面分布
        List<double> spancmlLst = new List<double>();
        List<double> spancslLst = new List<double>();


        string dimWString = "";
        string dimWSideString = "";
        string dimWMidString = "";

        string dimLString = "";
        string dimLSideString = "";
        string dimLMidString = "";

        string dimLLString = "";
        string dimLRString = "";
        string dimLMString = "";

        double sideOut = 0;
        double sideInner = 0;


        int BulkheadCount = 2;
        double FH = 0;
        double MH = 0;
        double BH = 0;
        double MHB = 0;

        double topThickness = 0;
        double bottomThickness = 0;

        double radius = 2;

        double lenN3a = 0;
        double lenN3 = 0;
        double lenN3T = 0;
        double lenN9 = 0;
        double lenN3All = 0;
        double lenN9All = 0;
        int  N12 = 0, N13 = 0;
        double lenN11All = 0;
        double lenN11L = 0;
        int N7N = 0, N8N = 0, N8aN = 0,N8BN = 0, N8aBN = 0;
        int N4a = 0, N5a = 0, N5b = 0;
        bool isModify = false;
        //截面放大倍数
        double extendscale = 1;
        string bridgeId = "";
        public PierRebar(PierPara para,double extendS=1, string _bridgeId = "")
        {
            bridgeId = _bridgeId;
            pierPara = para;
            N7N = 0; N8N = 0; N8aN = 0; N8BN = 0; N8aBN = 0;
            switch (para.pierRebar.reinforcement_grade)
            {
                //case "HRB300":
                //    strDiameter = "%%130";
                //    break;
                //case "HRB335":
                //    strDiameter = "%%131";
                //    break;
                //case "HRB400":
                //    strDiameter = "%%132";
                //    break;
                //case "HRB500":
                //    strDiameter = "%%133";
                //    break;
                //default:
                //    strDiameter = "%%130";
                //    break;
                case "HRB300":
                    strDiameter = "A";
                    break;
                case "HRB335":
                    strDiameter = "B";
                    break;
                case "HRB400":
                    strDiameter = "C";
                    break;
                case "HRB500":
                    strDiameter = "D";
                    break;
                case "HRB500E":
                    strDiameter = "D";
                    break;
                case "HRB600E":
                    strDiameter = "E";
                    break;
                case "HRB650E":
                    strDiameter = "F";
                    break;
                case "HRB700":
                    strDiameter = "G";
                    break;
                default:
                    strDiameter = "D";
                    break;
            }
            switch (para.pierRebar.main_reinforcement_grade)
            {
                //case "HRB300":
                //    strDiameter = "%%130";
                //    break;
                //case "HRB335":
                //    strDiameter = "%%131";
                //    break;
                //case "HRB400":
                //    strDiameter = "%%132";
                //    break;
                //case "HRB500":
                //    strDiameter = "%%133";
                //    break;
                //default:
                //    strDiameter = "%%130";
                //    break;
                case "HRB300":
                    strMainDiameter = "A";
                    break;
                case "HRB335":
                    strMainDiameter = "B";
                    break;
                case "HRB400":
                    strMainDiameter = "C";
                    break;
                case "HRB500":
                    strMainDiameter = "D";
                    break;
                case "HRB500E":
                    strMainDiameter = "D";
                    break;
                case "HRB600E":
                    strMainDiameter = "E";
                    break;
                case "HRB650E":
                    strMainDiameter = "F";
                    break;
                case "HRB700":
                    strMainDiameter = "G";
                    break;
                default:
                    strMainDiameter = "D";
                    break;
            }
            sideOut = pierPara.pierRebar.pier_protect_layer+ Math.Round((GeneralRebar.outerDiaNew[pierPara.pierRebar.main_reinforcement_diameter] * 0.1) * 0.5, 1) + Math.Round((GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_stirrup_reinforcement_diameter] * 0.1), 1);
            sideInner = pierPara.pierRebar.pier_protect_layer+ Math.Round((GeneralRebar.outerDiaNew[pierPara.pierRebar.inner_main_reinforcement_diameter] * 0.1) * 0.5, 1) + Math.Round((GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_stirrup_reinforcement_diameter] * 0.1), 1);
           
            double topH = pierPara.column.top_solid_h;
            double botH = pierPara.column.bottom_solid_h;
            string[] sizeT = pierPara.column.section_w_ang.Split('*');
            string[] sizeM = pierPara.column.section_mid_w_ang.Split('*');
            string[] sizeBulk = pierPara.column.bulkhead_size_w.Split('*');
            string[] sizeBulkL = pierPara.column.bulkhead_size_l.Split('*');

            double tH = double.Parse(sizeT[1]);
            double tw = double.Parse(sizeT[0]);
            double mH = double.Parse(sizeM[1]);
            double mw = double.Parse(sizeM[0]);
            double bH = double.Parse(sizeBulk[1]);
            double bw = double.Parse(sizeBulk[0]);
            double bwL = double.Parse(sizeBulkL[0]);
            int thickness = pierPara.column.top_thickness;
            topThickness = double.Parse(thickness.ToString());
            bottomThickness = double.Parse(thickness.ToString());
            FH = topH + tH + pierPara.pierRebar.top_encryption_spacing * 25.5;
            MH = pierPara.pierRebar.middle_encryption_spacing * 20 + mH * 2 + bH;
            BH = botH + tH + pierPara.pierRebar.bottom_encryption_spacing * 15;

            if (pierPara.pier_height <= 30)
                BulkheadCount = 0;
            else if (pierPara.pier_height > 30 && pierPara.pier_height <= 60)
                BulkheadCount = 1;
            else if (pierPara.pier_height >= 60)
                BulkheadCount = 2;
            if (BulkheadCount == 0)
            {
                FH = topH + tH + pierPara.pierRebar.top_encryption_spacing * 35.5;
                MH = 0;
                BH = botH + tH + pierPara.pierRebar.bottom_encryption_spacing * 35;
                if (FH + BH > pierPara.pier_height * 100)
                {
                    FH = pierPara.pier_height * 100 * 0.5;
                    MH = 0;
                    BH = pierPara.pier_height * 100 * 0.5;
                }
            }
            else if (BulkheadCount == 1)
                MH = pierPara.pierRebar.middle_encryption_spacing * 40 + mH * 2 + bH;
            else if (BulkheadCount == 2)
                MH = pierPara.pierRebar.middle_encryption_spacing * 20 + mH * 2 + bH;
            else
                MH = pierPara.pierRebar.middle_encryption_spacing * 15 + mH * 2 + bH;
         
            #region 钢筋分布

            #region 横桥向主筋分布
       
            RebarArrangement.ArrangeSpace(pierPara.column.top_w, pierPara.pierRebar.main_w_space,  sideOut, out spancwLst, out dimWString);
            int csNum = 0;
            RebarArrangement.ArrangeSpace(pierPara.column.top_w, topThickness, pierPara.pierRebar.main_l_space, sideOut, sideInner, out spancwLst, out dimWString, out dimWMidString, out dimWSideString,out csNum);

            //int csNum = (int)((topThickness - pierPara.pierRebar.pier_protect_layer - GeneralRebar.outerDiaNew[pierPara.pierRebar.main_reinforcement_diameter] * 0.1) / pierPara.pierRebar.main_w_space);
            int caNum = (int)((tw - GeneralRebar.outerDiaNew[pierPara.pierRebar.main_reinforcement_diameter] * 0.1 + pierPara.pierRebar.concrete_protect_layer) / pierPara.pierRebar.main_w_space);
            for (int i = 0; i < spancwLst.Count; i++)
            {
                if (i < csNum)
                    spancsLst.Add(spancwLst[i]);
                else if (i < csNum + caNum)
                {
                    spancaLst.Add(spancwLst[i]);
                }
                else if (i < spancwLst.Count - (csNum + caNum))
                {
                    spancmLst.Add(spancwLst[i]);
                }
            }
            double len = spancwLst.Sum();
            #endregion



            #region 横桥向主筋分布

            RebarArrangement.ArrangeSpace(pierPara.column.top_l, pierPara.pierRebar.main_l_space, sideOut, out spanclLst, out dimLString);
            int csLNum = 0;
           RebarArrangement.ArrangeSpace(pierPara.column.top_l, topThickness, pierPara.pierRebar.main_l_space, sideOut, sideInner, out spanclLst, out dimLString,out dimLMidString,out dimLSideString,out csLNum);

            //int csLNum = (int)((topThickness - pierPara.pierRebar.pier_protect_layer - GeneralRebar.outerDiaNew[pierPara.pierRebar.main_reinforcement_diameter] * 0.1) / pierPara.pierRebar.main_l_space);

            for (int i = 0; i < spanclLst.Count; i++)
            {
                if (i < csLNum)
                {
                    spancslLst.Add(spanclLst[i]);
                }
                else if (i < spanclLst.Count - csLNum)
                {
                    spancmlLst.Add(spanclLst[i]);
                }
            }
          
                dimLLString = dimLSideString;
                dimLRString = dimLSideString;
          
            dimLMString = dimLMidString;
            #endregion

            #endregion


            extendscale = extendS;
        }
        #region  "墩柱钢筋构造图"

        #region 第一页
        /// <summary>
        /// 立面A
        /// </summary>
        /// <param name="db"></param>
        /// <param name="ext"></param>
        /// <param name="insertPoint"></param>
        /// <param name="pierPara"></param>
        /// <param name="_scale"></param>
        public void PlotPierelEvationA(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "A-A", "", scale);
            Point2d pt = insertPoint.C2D(0, -3 * scale);
            double BeamW = pierPara.column.top_w * 1.5;
            //double pileCapW = pierPara.column.top_w * 1.6;
            Point3d ptDim = pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale);
            Point3d ptDimL = pt.C3D(-BeamW * 0.5 - 20 * scale);
            double halfPile = 15 * scale;//桩长示意长度

            Point3d ptDimT = ptDim;
            Point3d ptDimB = ptDim;
            #region 盖梁外轮廓绘制

            double BeamH = pierPara.pierRebar.beam_penetration_depth + 4 * scale;

            List<Point2d> ptLst = new List<Point2d>();
            Point2d pt1 = pt.C2D(-BeamW * 0.5);
            Point2d pt8 = pt.C2D(BeamW * 0.5);
            Point2d pt2 = pt1.C2D(0, -BeamH * 0.4);
            Point2d pt3 = pt.C2D(-pierPara.column.top_w * 0.5 - 15, -BeamH);
            Point2d pt4 = pt.C2D(-pierPara.column.top_w * 0.5, -BeamH);

            Point2d pt5 = pt4.C2D(pierPara.column.top_w);
            Point2d pt6 = pt5.C2D(15);
            Point2d pt7 = pt8.C2D(0, -BeamH * 0.4);

            ptLst.Add(pt1);
            ptLst.Add(pt2);
            ptLst.Add(pt3);
            ptLst.Add(pt4);
            //ptLst.Add(pt5);
            //ptLst.Add(pt6);
            //ptLst.Add(pt7);
            //ptLst.Add(pt8);
            Point2d ptBMid = pt.C2D(0, -BeamH);
        
            //PLPloter.AddPolylineByPointList(ptLst, ref ext, "H细线", false);

            ptLst = new List<Point2d>();
            ptLst.Add(pt5);
            ptLst.Add(pt6);
            ptLst.Add(pt7);
            ptLst.Add(pt8);
            //PLPloter.AddPolylineByPointList(ptLst, ref ext, "H细线", false);
            PLPloter.AddLine(db,pt4, pt5, ref ext, "H虚线");
            //PLPloter.CreateBreakLineP(db, ref ext, pt1, pt8, scale, "H细线");

            #region 钢筋绘制
            double total = 0;
            double lenW = Math.Round(spancwLst.Sum(), 1);
            double avg = sideOut;
            //for (int i = 0; i < spanBeamLst.Count - 1; i++)
            //{
            //    total += spanBeamLst[i];
            //    PLPloter.AddLine(db,pt4.C2D(avg, total), pt5.C2D(-avg, total), ref ext, "H钢筋");
            //}

            #endregion

            #endregion


            #region 墩身轮廓绘制
            double cap = 2 * scale;

            double columnH = (pierPara.h3 - pierPara.h2) * 100;
            //double angC = (pierPara.column.BottowW - pierPara.column.top_w)/(pierPara.h3- pierPara.h2);
            double topH = pierPara.column.top_solid_h;
            double botH = pierPara.column.bottom_solid_h;
            string[] sizeT = pierPara.column.section_w_ang.Split('*');
            string[] sizeM = pierPara.column.section_mid_w_ang.Split('*');
            string[] sizeBulk = pierPara.column.bulkhead_size_w.Split('*');
            string[] sizeBulkL = pierPara.column.bulkhead_size_l.Split('*');
            //double tH = double.Parse(sizeT[0]);
            //double tw = double.Parse(sizeT[1]);
            //double mH = double.Parse(sizeM[0]);
            //double mw = double.Parse(sizeM[1]);
            //double bH = double.Parse(sizeBulk[0]);
            //double bw = double.Parse(sizeBulk[1]);
            //double bwL = double.Parse(sizeBulkL[1]);
            double tH = double.Parse(sizeT[1]);
            double tw = double.Parse(sizeT[0]);
            double mH = double.Parse(sizeM[1]);
            double mw = double.Parse(sizeM[0]);
            double bH = double.Parse(sizeBulk[1]);
            double bw = double.Parse(sizeBulk[0]);
            double bwL = double.Parse(sizeBulkL[0]);
            //string[] thickness = pierPara.column.top_thickness.Split(',');
            //double topThickness = double.Parse(thickness[thickness.Length - 1]);
            //double bottomThickness = double.Parse(thickness[0]);
            //double FH = topH + tH + pierPara.pierRebar.top_encryption_spacing * 25.5;
            //double MH = pierPara.pierRebar.middle_encryption_spacing * 40 + mH * 2 + bH;
            //if(BulkheadCount==1)
            //    MH = pierPara.pierRebar.middle_encryption_spacing * 80 + mH * 2 + bH;
            //else if (BulkheadCount == 2)
            //    MH = pierPara.pierRebar.middle_encryption_spacing * 40 + mH * 2 + bH;
            //else
            //    MH = pierPara.pierRebar.middle_encryption_spacing * 30 + mH * 2 + bH;
            //double BH = botH + tH + pierPara.pierRebar.bottom_encryption_spacing* 25;
            #region 外轮廓上部
            //double FH = topH  + tH+25*scale;
            Point2d ptCF1 = ptBMid.C2D(-(pierPara.column.top_w * 0.5), -FH);
            Point2d ptCF2 = ptBMid.C2D((pierPara.column.top_w * 0.5), -FH);
            PLPloter.AddLine(db,pt4, ptCF1, ref ext, "H细线");
            PLPloter.AddLine(db,pt5, ptCF2, ref ext, "H细线");
            //if (pierPara.column.slope_w > 0)
            PLPloter.CreateBreakLineP(db, ref ext, ptCF1.C2D(-5 * scale), ptCF2.C2D(5 * scale), scale, "H细线");
            //else
            //    PLPloter.CreateBreakLineP(db, ref ext, ptCF1, ptCF2, scale, "H细线");

            DimPloter.AddLRMark(db,"E", pt4.C3D(-6 * scale, -4.5 * scale), ref ext, scale, true);
            DimPloter.AddLRMark(db,"E", pt5.C3D(6 * scale, -4.5 * scale), ref ext, scale, true);

            //DimPloter.AddLeft2RightBJ(db,"F", pt4.C3D(-6 * scale, -topH - tH - 5 * scale), ref ext, scale, 3, true);
            //DimPloter.AddLeft2RightBJ(db,"F", pt5.C3D(6 * scale, -topH - tH - 5 * scale), ref ext, scale, 3, false);
            #region 钢筋
            double len = 0;
            PLPloter.AddLine(db,ptCF1.C2D(avg, 0), pt4.C2D(avg, pierPara.pierRebar.beam_penetration_depth), ref ext, "H钢筋");
            for (int m = 0; m < spancwLst.Count; m++)
            {
                len += spancwLst[m];

                PLPloter.AddLine(db,ptCF1.C2D(avg + len), pt4.C2D(avg + len, pierPara.pierRebar.beam_penetration_depth), ref ext, "H钢筋");
            }

            int numR = (int)((FH-10) / pierPara.pierRebar.top_encryption_spacing);
            double lenH = 10;
            if (BulkheadCount > 0)
            {
                for (int i = 1; i <= numR; i++)
                {
                    lenH += pierPara.pierRebar.top_encryption_spacing;
                    if (isModify)
                    {
                        if (i % 3 == 0)
                            PLPloter.AddLine(db, ptCF1.C2D(avg, lenH), ptCF2.C2D(-avg, lenH), ref ext, "H钢筋");
                    }
                    else
                    {
                        PLPloter.AddLine(db, ptCF1.C2D(avg, lenH), ptCF2.C2D(-avg, lenH), ref ext, "H钢筋");
                    }
                }
            }
            else
            {
                numR = (int)((FH - 10-10* pierPara.pierRebar.middle_encryption_spacing) / pierPara.pierRebar.top_encryption_spacing);
                for (int i = 1; i <= 10; i++)
                {
                    lenH += pierPara.pierRebar.middle_encryption_spacing;
                    PLPloter.AddLine(db,ptCF1.C2D(avg, lenH), ptCF2.C2D(-avg, lenH), ref ext, "H钢筋");
                    if(i==10)
                        ptDimT = ptCF1.C3D(avg, lenH);
                }
                for (int i = 1; i <= numR; i++)
                {
                    lenH += pierPara.pierRebar.top_encryption_spacing;
                    if (isModify)
                    {
                        if (i % 3 == 0)
                            PLPloter.AddLine(db, ptCF1.C2D(avg, lenH), ptCF2.C2D(-avg, lenH), ref ext, "H钢筋");
                    }
                    else
                    {
                        PLPloter.AddLine(db, ptCF1.C2D(avg, lenH), ptCF2.C2D(-avg, lenH), ref ext, "H钢筋");
                    }
                   
                }
              
            }
            #endregion

            #endregion

            #region 内轮廓上部

            Point2d ptIC = ptBMid.C2D();
            Point2d ptICF1 = ptBMid.C2D(-pierPara.column.top_w * 0.5 + topThickness, -(topH + tH));
            Point2d ptICF2 = ptBMid.C2D(pierPara.column.top_w * 0.5 - topThickness, -(topH + tH));
            ptLst = new List<Point2d>();
            ptLst.Add(ptCF1.C2D(topThickness));
            ptLst.Add(ptICF1.C2D());
            ptLst.Add(ptICF1.C2D(tw, tH));
            ptLst.Add(ptICF2.C2D(-tw, tH));
            ptLst.Add(ptICF2.C2D());
            ptLst.Add(ptCF2.C2D(-topThickness));
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);



            #endregion

            #region 外轮廓中部
            //double MH = 40*scale  + mH*2+ bH;
            Point2d ptCM1 = ptCF1.C2D(0, -cap);
            Point2d ptCM2 = ptCF2.C2D(0, -cap);
            Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_w, -cap - MH);
            Point2d ptCM2E = ptCF2.C2D((MH) * pierPara.column.slope_w, -cap - MH);

            ptDimB = ptCM1E.C3D(avg, -FH*0.35);
            if (pierPara.column.slope_w > 0)
            {
                TextPloter.AddDBText(db,ptCM2.C3D(6 * scale, -10 * scale), ref ext, "1:" + 1 / pierPara.column.slope_w, scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90));
            }
            for (int i = 0; i < BulkheadCount; i++)
            {
                ptCM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_w, -cap * (i + 1) - MH * i);
                ptCM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_w, -cap * (i + 1) - MH * i);
                ptCM1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_w, -cap * (i + 1) - MH * (i + 1));
                ptCM2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_w, -cap * (i + 1) - MH * (i + 1));
                //if(pierPara.column.slope_w>0)
                PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(-5 * scale), ptCM2.C2D(5 * scale), scale, "H细线");
                //else
                //     PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(), ptCM2.C2D(), scale, "H墩身");
                PLPloter.AddLine(db,ptCM1, ptCM1E, ref ext, "H细线");
                PLPloter.AddLine(db,ptCM2, ptCM2E, ref ext, "H细线");
                //if (pierPara.column.slope_w > 0)
                PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale), ptCM2E.C2D(5 * scale), scale, "H细线");
                //else
                //    PLPloter.CreateBreakLineP(db, ref ext, ptCM1E, ptCM2E, scale, "H墩身");

                #region 钢筋
                len = 0;
                PLPloter.AddLine(db,ptCM1.C2D(avg), ptCM1E.C2D(avg), ref ext, "H钢筋");
                for (int m = 0; m < spancwLst.Count; m++)
                {
                    len += spancwLst[m];
                    if (isModify)
                    {
                        if (m % 3 == 0)
                            PLPloter.AddLine(db, ptCM1.C2D(avg + len), ptCM1E.C2D(avg + len), ref ext, "H钢筋");
                    }
                    else
                    {
                        PLPloter.AddLine(db, ptCM1.C2D(avg + len), ptCM1E.C2D(avg + len), ref ext, "H钢筋");
                    }
                }

                if (BulkheadCount > 1)
                {
                    if (i == 0)
                    {
                        numR = (int)((MH - pierPara.pierRebar.top_encryption_spacing * 10-10) / pierPara.pierRebar.middle_encryption_spacing);
                        lenH = 10;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebar.top_encryption_spacing;
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                    PLPloter.AddLine(db, ptCM1.C2D(avg, -lenH), ptCM2.C2D(-avg, -lenH), ref ext, "H钢筋");
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptCM1.C2D(avg, -lenH), ptCM2.C2D(-avg, -lenH), ref ext, "H钢筋");
                            }
                            if (m == 10)
                                ptDimT = ptCM1.C3D(avg, -lenH);
                        }
                        for (int m = 1; m <= numR-1; m++)
                        {
                            lenH += pierPara.pierRebar.middle_encryption_spacing;
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                    PLPloter.AddLine(db, ptCM1.C2D(avg, -lenH), ptCM2.C2D(-avg, -lenH), ref ext, "H钢筋");
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptCM1.C2D(avg, -lenH), ptCM2.C2D(-avg, -lenH), ref ext, "H钢筋");
                            }
                        }
                    }
                    else if (i == BulkheadCount - 1)
                    {
                        numR = (int)((MH - pierPara.pierRebar.bottom_encryption_spacing * 10-10) / pierPara.pierRebar.middle_encryption_spacing);
                        lenH = 10;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebar.bottom_encryption_spacing;
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                    PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            }
                            if (m == 10)
                                ptDimB = ptCM1E.C3D(avg, lenH);
                        }
                        for (int m = 1; m <= numR-1; m++)
                        {
                            lenH += pierPara.pierRebar.middle_encryption_spacing;
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                    PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            }
                        }
                    }
                    else 
                    {
                        //numR = (int)((MH - pierPara.pierRebar.bottom_encryption_spacing * 10 - pierPara.pierRebar.top_encryption_spacing * 10-10) / pierPara.pierRebar.middle_encryption_spacing);
                        numR = (int)((MH  - 10) / pierPara.pierRebar.middle_encryption_spacing);
                        lenH = 10;
                        //for (int m = 1; m <= 10; m++)
                        //{
                        //    lenH += pierPara.pierRebar.bottom_encryption_spacing;
                        //    PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        //    if (m == 10)
                        //        ptDimB = ptCM1E.C3D(avg, lenH);
                        //}
                        for (int m = 1; m <= numR-1; m++)
                        {
                            lenH += pierPara.pierRebar.middle_encryption_spacing;
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                    PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            }
                        }
                        //for (int m = 1; m <= 10; m++)
                        //{
                        //    lenH += pierPara.pierRebar.top_encryption_spacing;
                        //    PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        //    if (m == 1)
                        //        ptDimT = ptCM1E.C3D(avg, lenH);
                        //}
                    }
                }
                else 
                {
                    numR = (int)((MH - pierPara.pierRebar.bottom_encryption_spacing * 10 - pierPara.pierRebar.top_encryption_spacing * 10-10) / pierPara.pierRebar.middle_encryption_spacing);
                    lenH = 10;
                    for (int m = 1; m <= 10; m++)
                    {
                        lenH += pierPara.pierRebar.bottom_encryption_spacing;
                        if (isModify)
                        {
                            if (m % 3 == 0)
                                PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        }
                        if (m == 10)
                            ptDimB = ptCM1E.C3D(avg, lenH);
                    }
                    for (int m = 1; m <= numR; m++)
                    {
                        lenH += pierPara.pierRebar.middle_encryption_spacing;
                        if (isModify)
                        {
                            if (m % 3 == 0)
                                PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        }
                    }
                    for (int m = 1; m <= 10; m++)
                    {
                        lenH += pierPara.pierRebar.top_encryption_spacing;
                        if (isModify)
                        {
                            if (m % 3 == 0)
                                PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        }
                        if (m == 1)
                            ptDimT = ptCM1E.C3D(avg, lenH);
                    }
                }
                #endregion
            }
            #endregion

            #region 内轮廓中部
            Point2d ptICM = ptBMid.C2D(0, -FH - cap);
            Point2d ptICM1 = ptCF1.C2D(0, -cap);
            Point2d ptICM2 = ptCF2.C2D(0, -cap);
            double HB = (MH - mH * 2 - bH) * 0.5;
            //Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_w, -cap - MH);
            for (int i = 0; i < BulkheadCount; i++)
            {
                ptLst = new List<Point2d>();
                ptICM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * i);
                ptICM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * i);
                Point2d ptICM3 = ptCF1.C2D(-(MH * i + HB) * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * i - HB);
                Point2d ptICM4 = ptCF2.C2D((MH * i + HB) * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * i - HB);
                Point2d ptICM5 = ptICM3.C2D(mw, -mH);
                Point2d ptICM6 = ptICM4.C2D(-mw, -mH);
                ptLst.Add(ptICM1);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptICM2);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);
                //Point3d ptMM = GeTools.MidPoint(ptICM3.C3D(), ptICM5.C3D());
                //DimPloter.AddMLeader(db,ptMM.C2D(), ptMM.C2D(2 * scale, 5 * scale), pierPara.column.section_mid_w_ang, ref ext, scale);
                #region 隔板
                ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i - HB - mH);
                PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(-bw * 0.5, -bH), ref ext, "H虚线");
                PLPloter.AddLine(db,ptICM.C2D(bw * 0.5), ptICM.C2D(bw * 0.5, -bH), ref ext, "H虚线");

                #endregion

                ptLst = new List<Point2d>();
                Point2d ptCMI1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * (i + 1));
                Point2d ptCMI2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * (i + 1));
                ptICM3 = ptCF1.C2D(-(MH * i + HB + mH * 2 + bH) * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                ptICM4 = ptCF2.C2D((MH * i + HB + mH * 2 + bH) * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                ptICM5 = ptICM3.C2D(mw, mH);
                ptICM6 = ptICM4.C2D(-mw, mH);
                ptLst.Add(ptCMI1E);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptCMI2E);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);


            }




            #endregion

            DimPloter.AddLRMark(db,"F", ptDimB.C3D(-6 * scale, -3 * scale), ref ext, scale, true);
            DimPloter.AddLRMark(db,"F", ptDimB.C3D(6 * scale + pierPara.column.top_w, -3 * scale), ref ext, scale, true);
            #region 外轮廓下部
            //double BH = botH  + tH +25*scale;
            Point2d ptBottomC = new Point2d(ptBMid.X, ptCM2E.Y - cap - BH);
            double BottomW = pierPara.column.top_w + pierPara.pier_height * 100 * pierPara.column.slope_w;

            Point2d ptCB1E = ptBottomC.C2D(-BottomW * 0.5);
            Point2d ptCB2E = ptBottomC.C2D(BottomW * 0.5);
            Point2d ptCB1 = ptCB1E.C2D(BH * pierPara.column.slope_w, BH);
            Point2d ptCB2 = ptCB2E.C2D(-BH * pierPara.column.slope_w, BH);
            PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale, -cap), ptCM2E.C2D(5 * scale, -cap), scale, "H细线");
            PLPloter.AddLine(db,ptCB1, ptCB1E, ref ext, "H细线");
            PLPloter.AddLine(db,ptCB2, ptCB2E, ref ext, "H细线");
            PLPloter.AddLine(db,ptCB1E, ptCB2E, ref ext, "H细线");

            //if (pierPara.column.slope_w == 0)
            //    DimPloter.DimRot(db, ptBottomC.C3D(-BottomW * 0.5), ptBottomC.C3D(BottomW * 0.5), ptBottomC.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //else
            //    DimPloter.DimRot(db, ptBottomC.C3D(-BottomW * 0.5), ptBottomC.C3D(BottomW * 0.5), ptBottomC.C3D(0, -8 * scale), ref ext, 0, scale, "Bd1", Unit.Centimeter, Unit.Centimeter);

            numR = (int)((BH - pierPara.pierRebar.pier_v_reinforcement_pilecap_depth-10) / pierPara.pierRebar.bottom_encryption_spacing);
            lenH = 0;
            if (BulkheadCount > 0)
            {
                for (int i = 0; i < numR; i++)
                {
                    if (i > 0)
                        lenH += pierPara.pierRebar.bottom_encryption_spacing;
                    if (isModify)
                    {
                        if (i % 3 == 0)
                            PLPloter.AddLine(db, ptCB1E.C2D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                    }
                    else
                    {
                        PLPloter.AddLine(db, ptCB1E.C2D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                    }
                }
            }
            else
            {
                numR = (int)((BH - pierPara.pierRebar.pier_v_reinforcement_pilecap_depth - 10-10 * pierPara.pierRebar.middle_encryption_spacing) / pierPara.pierRebar.bottom_encryption_spacing);

                for (int i = 0; i < numR; i++)
                {
                    if (i > 0)
                        lenH += pierPara.pierRebar.bottom_encryption_spacing;
                    if (isModify)
                    {
                        if (i % 3 == 0)
                            PLPloter.AddLine(db, ptCB1E.C2D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                    }
                    else
                    {
                        PLPloter.AddLine(db, ptCB1E.C2D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                    }
                    if (i == numR - 1)
                        ptDimB = ptCB1E.C3D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth);
                }
                for (int i = 0; i < 10; i++)
                {                 
                    lenH += pierPara.pierRebar.middle_encryption_spacing;
                    if (isModify)
                    {
                        if (i % 3 == 0)
                            PLPloter.AddLine(db, ptCB1E.C2D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                    }
                    else
                    {
                        PLPloter.AddLine(db, ptCB1E.C2D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                    }
                }
            }

            //DimPloter.AddLeft2RightBJ(db,"H", ptCB1E.C3D(-6 * scale, botH + tH + 5 * scale), ref ext, scale, 3, true);
            //DimPloter.AddLeft2RightBJ(db,"H", ptCB2E.C3D(6 * scale, botH + tH + 5 * scale), ref ext, scale, 3, false);

            DimPloter.AddLRMark(db,"G", ptBottomC.C3D(-6 * scale- pierPara.column.top_w * 0.5, 0 * scale), ref ext, scale, false);
            DimPloter.AddLRMark(db,"G", ptBottomC.C3D(6 * scale + pierPara.column.top_w*0.5, 0 * scale), ref ext, scale, false);
            #endregion

            #region 内轮廓下部
            ptLst = new List<Point2d>();
            double BIH = botH + tH;
            //Point2d ptCB1IE = ptBottomC.C2D(-BottomW * 0.5+bottomThickness);
            //Point2d ptCB2IE = ptBottomC.C2D(BottomW * 0.5- bottomThickness);
            Point2d ptICB1 = ptCB1E.C2D(BH * pierPara.column.slope_w + bottomThickness, BH);
            Point2d ptICB2 = ptCB2E.C2D(-BH * pierPara.column.slope_w - bottomThickness, BH);
            Point2d ptICB3 = ptCB1E.C2D(BIH * pierPara.column.slope_w + bottomThickness, BIH);
            Point2d ptICB4 = ptCB2E.C2D(-BIH * pierPara.column.slope_w - bottomThickness, BIH);
            Point2d ptICB5 = ptICB3.C2D(bottomThickness, -tH);
            Point2d ptICB6 = ptICB4.C2D(-bottomThickness, -tH);
            ptLst.Add(ptICB1);
            ptLst.Add(ptICB3);
            ptLst.Add(ptICB5);
            ptLst.Add(ptICB6);
            ptLst.Add(ptICB4);
            ptLst.Add(ptICB2);
            //PLPloter.AddPolylineByPointList(ptLst, ref ext, "H虚线", false);
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);
            #endregion


            #endregion

            #region 承台外轮廓绘制
            double pileCapW = pierPara.column.top_w * 1.6;// pierPara.pileCap.pile_cap_width;
            double pileCapH = pierPara.pileCap.pile_cap_height > pierPara.pierRebar.pilecap_penetration_depth + 3 * scale ? pierPara.pileCap.pile_cap_height : (pierPara.pierRebar.pilecap_penetration_depth + 3 * scale);
            ptLst = new List<Point2d>();
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5));
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5));
            //PLPloter.AddPolylineByPointList(ptLst, ref ext, "H细线", true);

            #region 钢筋绘制

            len = 0;
            Point2d ptbt1 = ptBottomC.C2D(-pierPara.column.top_w * 0.5 + avg, -pierPara.pierRebar.pilecap_penetration_depth);
            PLPloter.AddLine(db,ptCB1.C2D(avg), ptbt1, ref ext, "H钢筋");
            for (int m = 0; m < spancwLst.Count; m++)
            {
                len += spancwLst[m];

                PLPloter.AddLine(db,ptCB1.C2D(avg + len), ptbt1.C2D(len), ref ext, "H钢筋");

            }
            if (pierPara.pierRebar.top_encryption_length > 0)
            {
                DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptDimT.C3D(), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebar.top_encryption_length / pierPara.pierRebar.top_encryption_spacing + "×" + pierPara.pierRebar.top_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptDimT.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "L-" + pierPara.pierRebar.top_encryption_length / pierPara.pierRebar.top_encryption_spacing + "×" + pierPara.pierRebar.top_encryption_spacing + "-" + pierPara.pierRebar.bottom_encryption_length / pierPara.pierRebar.bottom_encryption_spacing + "×" + pierPara.pierRebar.bottom_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, ptDimT.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "n1×" + pierPara.pierRebar.middle_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            }
            else
            {
                DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "n1×" + pierPara.pierRebar.middle_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            }
                DimPloter.DimRot(db, ptDimB.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebar.bottom_encryption_length / pierPara.pierRebar.bottom_encryption_spacing + "×" + pierPara.pierRebar.bottom_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            if (pierPara.pierRebar.pier_v_reinforcement_pilecap_depth > 0)
                DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);


            //DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBMid.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebar.beam_penetration_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebar.beam_penstration_layout, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBMid.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebar.beam_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, -pierPara.pierRebar.pilecap_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "H", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, -pierPara.pierRebar.pilecap_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);


            string v = dimWString;
            DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5), ptBottomC.C3D(0, -pileCapH - 5 * scale), ref ext, 0, scale, v, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5), ptBottomC.C3D(0, -pileCapH - 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            #endregion

            #endregion

            List<double> lList = new List<double>();
            //lList.Add(pierPara.column.top_w - avg * 2);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBottomC.C3D(-pierPara.column.top_w * 0.5 + avg, -pierPara.pierRebar.pilecap_penetration_depth + 20), ArrowDirection.West, new List<double>(), spancwLst, "1", scale, true, 4, 5 * scale);


            lList = new List<double>();

            for (int i = 0; i < 5; i++)
            {
                lList.Add(pierPara.pierRebar.middle_encryption_spacing);
            }
            for (int i = 0; i < 5; i++)
            {
                lList.Add(pierPara.pierRebar.bottom_encryption_spacing);
            }
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptDimB.C3D(pierPara.column.top_w * 0.5+4, 5 * pierPara.pierRebar.middle_encryption_spacing), ArrowDirection.South, lList, new List<double>(), "4", scale, true, 1, pierPara.column.top_w * 0.5 + 5 * scale);
        }


        /// <summary>
        /// 侧面C
        /// </summary>
        /// <param name="db"></param>
        /// <param name="ext"></param>
        /// <param name="insertPoint"></param>
        /// <param name="pierPara"></param>
        /// <param name="_scale"></param>
        public void PlotPierSideB(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "B-B", "", scale);
            Point2d pt = insertPoint.C2D(0, -3 * scale);
            //Point3d ptDim = pt.C3D(pierPara.pileCap.pile_cap_length * 0.5 + 10 * scale);
            //double halfPile = 15 * scale;//桩长示意长度
            double BeamW = pierPara.column.top_l + 20;
            Point3d ptDim = pt.C3D(-pierPara.column.top_w * 0.5 - 20 * scale);
            Point3d ptDimL = pt.C3D(-pierPara.column.top_l*1.6*0.5 - 15 * scale);

            Point3d ptDimT = ptDim;
            Point3d ptDimB = ptDim;
            #region 盖梁外轮廓绘制
            double BeamH = pierPara.pierRebar.beam_penetration_depth + 4 * scale;

            List<Point2d> ptLst = new List<Point2d>();
            Point2d pt1 = pt.C2D(-BeamW * 0.5);
            Point2d pt6 = pt.C2D(BeamW * 0.5);
            Point2d pt2 = pt1.C2D(0, -BeamH);
            Point2d pt3 = pt.C2D(-pierPara.column.top_l * 0.5, -BeamH);
            Point2d pt4 = pt.C2D(pierPara.column.top_l * 0.5, -BeamH);
            Point2d pt5 = pt6.C2D(0, -BeamH);

            ptLst.Add(pt1);
            ptLst.Add(pt2);
            ptLst.Add(pt3);
           
            Point2d ptBMid = pt.C2D(0, -BeamH);

            //PLPloter.AddPolylineByPointList(ptLst, ref ext, "H细线", false);

            ptLst = new List<Point2d>();
            ptLst.Add(pt4);
            ptLst.Add(pt5);
            ptLst.Add(pt6);
            //PLPloter.AddPolylineByPointList(ptLst, ref ext, "H细线", false);
            PLPloter.AddLine(db,pt3, pt4, ref ext, "H虚线");
            //PLPloter.CreateBreakLineP(db, ref ext, pt1, pt6, scale, "H细线");


            #region 钢筋绘制

            double total = 0;
            double lenL = Math.Round(spanclLst.Sum(), 1);
            double avg = sideOut;

            #endregion

            #endregion



            #region 墩身外轮廓绘制
            double cap = 2 * scale;
            //int BulkheadCount = 2;
            double columnH = (pierPara.h3 - pierPara.h2) * 100;
            //double angC = (pierPara.column.BottowW - pierPara.column.top_w)/(pierPara.h3- pierPara.h2);
            double topH = pierPara.column.top_solid_h;
            double botH = pierPara.column.bottom_solid_h;
            string[] sizeT = pierPara.column.section_l_ang.Split('*');
            string[] sizeM = pierPara.column.section_mid_l_ang.Split('*');
            string[] sizeBulk = pierPara.column.bulkhead_size_l.Split('*');
            //double tH = double.Parse(sizeT[0]);
            //double tw = double.Parse(sizeT[1]);
            //double mH = double.Parse(sizeM[0]);
            //double mw = double.Parse(sizeM[1]);
            //double bH = double.Parse(sizeBulk[0]);
            //double bw = double.Parse(sizeBulk[1]);
            double tH = double.Parse(sizeT[1]);
            double tw = double.Parse(sizeT[0]);
            double mH = double.Parse(sizeM[1]);
            double mw = double.Parse(sizeM[0]);
            double bH = double.Parse(sizeBulk[1]);
            double bw = double.Parse(sizeBulk[0]);
            //double bwL = double.Parse(sizeBulkL[1]);

            #region 外轮廓上部

            Point2d ptCF1 = ptBMid.C2D(-(pierPara.column.top_l * 0.5 + FH * pierPara.column.slope_l), -FH);
            Point2d ptCF2 = ptBMid.C2D((pierPara.column.top_l * 0.5 + FH * pierPara.column.slope_l), -FH);
            PLPloter.AddLine(db,pt3, ptCF1, ref ext, "H细线");
            PLPloter.AddLine(db,pt4, ptCF2, ref ext, "H细线");
            //PLPloter.CreateBreakLineP(db, ref ext, ptCF1.C2D(-5 * scale), ptCF2.C2D(5 * scale), scale, "H细线");
          
            if(BulkheadCount==0)
                PLPloter.CreateBreakLineP(db, ref ext, ptCF1.C2D(-5 * scale), ptCF2.C2D(5 * scale), scale, "H细线");
            else
                PLPloter.CreateBreakLineP(db, ref ext, ptCF1.C2D(-5 * scale - 1 * scale), ptCF2.C2D(5 * scale + 1 * scale), scale, "H细线");
            #region 钢筋
            double len = 0;

            Point2d ptSt = pt3.C2D(avg + pierPara.pierRebar.beam_penetration_depth * pierPara.column.slope_l, pierPara.pierRebar.beam_penetration_depth);
            double stL = lenL - pierPara.pierRebar.beam_penetration_depth * pierPara.column.slope_l * 2;
            List<Point2d> ptTLst = new List<Point2d>();
            RebarArrangement.ArrangePoint(ptSt, spancslLst, spancmlLst, lenL, stL, out ptTLst);
            Point2d ptEnd = ptCF1.C2D(avg);
            double endL = lenL + FH * pierPara.column.slope_l * 2;
            List<Point2d> ptBLst = new List<Point2d>();
            RebarArrangement.ArrangePoint(ptEnd, spancslLst, spancmlLst, lenL, endL, out ptBLst);
            PLPloter.AddLine(db,ptSt, ptEnd, ref ext, "H钢筋");
            for (int m = 0; m < ptTLst.Count; m++)
            {
                PLPloter.AddLine(db,ptTLst[m], ptBLst[m], ref ext, "H钢筋");
            }
            int numR = (int)((FH-10) / pierPara.pierRebar.top_encryption_spacing);
            double lenH = 10;
            if (BulkheadCount > 0)
            {
                for (int i = 1; i <= numR; i++)
                {
                    lenH += pierPara.pierRebar.top_encryption_spacing;
                    if (isModify)
                    {
                        if (i % 3 == 0)
                            PLPloter.AddLine(db, ptCF1.C2D(avg + (lenH) * pierPara.column.slope_l, lenH), ptCF2.C2D(-avg - (lenH) * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                    }
                    else
                    {
                        PLPloter.AddLine(db, ptCF1.C2D(avg + (lenH) * pierPara.column.slope_l, lenH), ptCF2.C2D(-avg - (lenH) * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                    }
                }
            }
            else
            {
                numR = (int)((FH - 10 - 10 * pierPara.pierRebar.middle_encryption_spacing) / pierPara.pierRebar.top_encryption_spacing);
                for (int i = 1; i <= 10; i++)
                {
                    lenH += pierPara.pierRebar.middle_encryption_spacing;
                    if (isModify)
                    {
                        if (i % 3 == 0)
                            PLPloter.AddLine(db, ptCF1.C2D(avg + (lenH) * pierPara.column.slope_l, lenH), ptCF2.C2D(-avg - (lenH) * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                    }
                    else
                    {
                        PLPloter.AddLine(db, ptCF1.C2D(avg + (lenH) * pierPara.column.slope_l, lenH), ptCF2.C2D(-avg - (lenH) * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                    }
                    if (i == 10)
                        ptDimT = ptCF1.C3D(avg, lenH);
                }
                for (int i = 1; i <= numR; i++)
                {
                    lenH += pierPara.pierRebar.top_encryption_spacing;
                    if (isModify)
                    {
                        if (i % 3 == 0)
                            PLPloter.AddLine(db, ptCF1.C2D(avg + (lenH) * pierPara.column.slope_l, lenH), ptCF2.C2D(-avg - (lenH) * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                    }
                    else
                    {
                        PLPloter.AddLine(db, ptCF1.C2D(avg + (lenH) * pierPara.column.slope_l, lenH), ptCF2.C2D(-avg - (lenH) * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                    }
                }
            }
            #endregion
            #endregion

            #region 内轮廓上部

            Point2d ptIC = ptBMid.C2D(0, -topH);
            Point2d ptICF1 = ptBMid.C2D(-(pierPara.column.top_l * 0.5 + (topH + tH) * pierPara.column.slope_l) + topThickness, -(topH + tH));
            Point2d ptICF2 = ptBMid.C2D((pierPara.column.top_l * 0.5 + (topH + tH) * pierPara.column.slope_l) - topThickness, -(topH + tH));
            ptLst = new List<Point2d>();
            ptLst.Add(ptCF1.C2D(topThickness));
            ptLst.Add(ptICF1.C2D());
            ptLst.Add(ptICF1.C2D(tw, tH));
            ptLst.Add(ptICF2.C2D(-tw, tH));
            ptLst.Add(ptICF2.C2D());
            ptLst.Add(ptCF2.C2D(-topThickness));
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);

            #endregion

            #region 外轮廓中部

            Point2d ptCM1 = ptCF1.C2D(0, -cap);
            Point2d ptCM2 = ptCF2.C2D(0, -cap);
            Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_l, -cap - MH);
            Point2d ptCM2E = ptCF2.C2D((MH) * pierPara.column.slope_l, -cap - MH);

            if (BulkheadCount == 0)
            {
                ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_w, -MH);
                ptCM2E = ptCF2.C2D((MH) * pierPara.column.slope_w, -MH);
            }
            Point2d ptICM = ptBMid.C2D(0, -FH - cap);
            Point2d ptICM1 = ptCF1.C2D(0, -cap);
            Point2d ptICM2 = ptCF2.C2D(0, -cap);
            double HB = (MH - mH * 2 - bH) * 0.5;
            Point2d ptCM1ELast = ptCF1.C2D(-(MH) * pierPara.column.slope_l, -cap - MH);
            Point2d ptCM2ELast = ptCF2.C2D((MH) * pierPara.column.slope_l, -cap - MH);


            for (int i = 0; i < BulkheadCount; i++)
            {
                //ptCF1 = ptCF1.C2D(-1 * scale);
                //ptCF2 = ptCF2.C2D(1 * scale);

                //ptCM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_l, -cap * (i + 1) - MH * i);
                //ptCM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_l, -cap * (i + 1) - MH * i);
                //ptCM1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_l, -cap * (i + 1) - MH * (i + 1));
                //ptCM2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_l, -cap * (i + 1) - MH * (i + 1));
                ptCF1 = ptCF1.C2D(-1 * scale);
                ptCF2 = ptCF2.C2D(1 * scale);
                ptCM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_l, -cap * (i + 1) - MH * i);
                ptCM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_l, -cap * (i + 1) - MH * i);
                ptCM1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_l, -cap * (i + 1) - MH * (i + 1));
                ptCM2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_l, -cap * (i + 1) - MH * (i + 1));
                if (i == 0)
                    PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(-5 * scale - 1 * scale * i), ptCM2.C2D(5 * scale + 1 * scale * i), scale, "H细线");
                else
                    PLPloter.CreateBreakLineP(db, ref ext, ptCM1ELast.C2D(-5 * scale, -cap), ptCM2ELast.C2D(5 * scale, -cap), scale, "H细线");
                PLPloter.AddLine(db,ptCM1, ptCM1E, ref ext, "H细线");
                PLPloter.AddLine(db,ptCM2, ptCM2E, ref ext, "H细线");
                if (i < BulkheadCount - 1)
                    PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale), ptCM2E.C2D(5 * scale), scale, "H细线");

                ptCM1ELast = ptCM1E;
                ptCM2ELast = ptCM2E;
                #region 钢筋

                ptSt = ptCM1.C2D(avg);
                //stL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * i * pierPara.column.slope_l * 2 + 2 * scale * i;
                stL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * i * pierPara.column.slope_l * 2 + 2 * (i + 1) * scale;
                ptTLst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptSt, spancslLst, spancmlLst, lenL, stL, out ptTLst);
                ptEnd = ptCM1E.C2D(avg);
                endL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2 + 2 * (i + 1) * scale;
                ptBLst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptEnd, spancslLst, spancmlLst, lenL, endL, out ptBLst);
                PLPloter.AddLine(db,ptSt, ptEnd, ref ext, "H钢筋");
                for (int m = 0; m < ptTLst.Count; m++)
                {
                    PLPloter.AddLine(db,ptTLst[m], ptBLst[m], ref ext, "H钢筋");
                }

                if (BulkheadCount > 1)
                {
                    if (i == 0)
                    {
                        numR = (int)((MH - pierPara.pierRebar.top_encryption_spacing * 10-10) / pierPara.pierRebar.middle_encryption_spacing);
                        lenH = 10;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebar.top_encryption_spacing;
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                    PLPloter.AddLine(db, ptCM1.C2D(avg - lenH * pierPara.column.slope_l, -lenH), ptCM2.C2D(-avg + lenH * pierPara.column.slope_l, -lenH), ref ext, "H钢筋");
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptCM1.C2D(avg - lenH * pierPara.column.slope_l, -lenH), ptCM2.C2D(-avg + lenH * pierPara.column.slope_l, -lenH), ref ext, "H钢筋");
                            }
                            if (m == 10)
                                ptDimT = ptCM1.C3D(avg - lenH * pierPara.column.slope_l, -lenH);
                        }
                        for (int m = 1; m <= numR-1; m++)
                        {
                            lenH += pierPara.pierRebar.middle_encryption_spacing;
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                    PLPloter.AddLine(db, ptCM1.C2D(avg - lenH * pierPara.column.slope_l, -lenH), ptCM2.C2D(-avg + lenH * pierPara.column.slope_l, -lenH), ref ext, "H钢筋");
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptCM1.C2D(avg - lenH * pierPara.column.slope_l, -lenH), ptCM2.C2D(-avg + lenH * pierPara.column.slope_l, -lenH), ref ext, "H钢筋");
                            }
                        }
                    }
                    else if (i == BulkheadCount - 1)
                    {
                        numR = (int)((MH - pierPara.pierRebar.bottom_encryption_spacing * 10-10) / pierPara.pierRebar.middle_encryption_spacing);
                        lenH = 10;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebar.bottom_encryption_spacing;
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                    PLPloter.AddLine(db, ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                            }
                            if (m == 10)
                                ptDimB = ptCM1E.C3D(avg + lenH * pierPara.column.slope_l, lenH);
                        }
                        for (int m = 1; m <= numR-1; m++)
                        {
                            lenH += pierPara.pierRebar.middle_encryption_spacing;
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                    PLPloter.AddLine(db, ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                            }
                        }
                    }
                    else
                    {
                        //numR = (int)((MH - pierPara.pierRebar.bottom_encryption_spacing * 10 - pierPara.pierRebar.top_encryption_spacing * 10-10) / pierPara.pierRebar.middle_encryption_spacing);
                        numR = (int)((MH - 10) / pierPara.pierRebar.middle_encryption_spacing);
                        lenH = 10;
                        //for (int m = 1; m <= 10; m++)
                        //{
                        //    lenH += pierPara.pierRebar.bottom_encryption_spacing;
                        //    PLPloter.AddLine(db,ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                        //    if (m == 10)
                        //        ptDimB = ptCM1E.C3D(avg + lenH * pierPara.column.slope_l, lenH);
                        //}
                        for (int m = 1; m <= numR-1; m++)
                        {
                            lenH += pierPara.pierRebar.middle_encryption_spacing;
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                    PLPloter.AddLine(db, ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                            }
                        }
                        //for (int m = 1; m <= 10; m++)
                        //{
                        //    lenH += pierPara.pierRebar.top_encryption_spacing;
                        //    PLPloter.AddLine(db,ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                        //    if (m == 1)
                        //        ptDimT = ptCM1E.C3D(avg, lenH);
                        //}
                    }
                }
                else
                {
                    numR = (int)((MH - pierPara.pierRebar.bottom_encryption_spacing * 10 - pierPara.pierRebar.top_encryption_spacing * 10 - 10) / pierPara.pierRebar.middle_encryption_spacing);
                    //numR = (int)((MH  - 10) / pierPara.pierRebar.middle_encryption_spacing);
                    lenH = 10;
                    for (int m = 1; m <= 10; m++)
                    {
                        lenH += pierPara.pierRebar.bottom_encryption_spacing;
                        if (isModify)
                        {
                            if (m % 3 == 0)
                                PLPloter.AddLine(db, ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                        }
                            if (m == 10)
                            ptDimB = ptCM1E.C3D(avg + lenH * pierPara.column.slope_l, lenH);
                    }
                    for (int m = 1; m <= numR-1; m++)
                    {
                        lenH += pierPara.pierRebar.middle_encryption_spacing;
                        if (isModify)
                        {
                            if (m % 3 == 0)
                                PLPloter.AddLine(db, ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                        }
                    }
                    for (int m = 1; m <= 10; m++)
                    {
                        lenH += pierPara.pierRebar.top_encryption_spacing;
                        if (isModify)
                        {
                            if (m % 3 == 0)
                                PLPloter.AddLine(db, ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                        }
                        if (m == 1)
                            ptDimT = ptCM1E.C3D(avg + lenH * pierPara.column.slope_l, lenH);
                    }
                }
                #endregion

                #region 内轮廓
                ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i);
                ptLst = new List<Point2d>();
                ptICM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i);
                ptICM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i);
                Point2d ptICM3 = ptCF1.C2D(-(MH * i + HB) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i - HB);
                Point2d ptICM4 = ptCF2.C2D((MH * i + HB) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i - HB);
                Point2d ptICM5 = ptICM3.C2D(mw, -mH);
                Point2d ptICM6 = ptICM4.C2D(-mw, -mH);
                ptLst.Add(ptICM1);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptICM2);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);

                #region 隔板
                ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i - HB - mH);
                PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(-bw * 0.5, -bH), ref ext, "H虚线");
                PLPloter.AddLine(db,ptICM.C2D(bw * 0.5), ptICM.C2D(bw * 0.5, -bH), ref ext, "H虚线");


                #endregion

                ptLst = new List<Point2d>();
                Point2d ptCMI1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * (i + 1));
                Point2d ptCMI2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * (i + 1));
                ptICM3 = ptCF1.C2D(-(MH * i + HB + mH * 2 + bH) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                ptICM4 = ptCF2.C2D((MH * i + HB + mH * 2 + bH) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                ptICM5 = ptICM3.C2D(mw, mH);
                ptICM6 = ptICM4.C2D(-mw, mH);
                ptLst.Add(ptCMI1E);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptCMI2E);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);
                #endregion
            }


            #endregion


            #endregion

            #region 外轮廓下部

            Point2d ptBottomC = new Point2d(ptBMid.X, ptCM2E.Y - cap - BH);
            double BottomW = pierPara.column.top_l + pierPara.pier_height * 100 * pierPara.column.slope_l*2;

            Point2d ptCB1E = ptBottomC.C2D(-BottomW * 0.5);
            Point2d ptCB2E = ptBottomC.C2D(BottomW * 0.5);
            Point2d ptCB1 = ptCB1E.C2D(BH * pierPara.column.slope_l, BH);
            Point2d ptCB2 = ptCB2E.C2D(-BH * pierPara.column.slope_l, BH);
            PLPloter.CreateBreakLineP(db, ref ext, ptCB1.C2D(-5 * scale), ptCB2.C2D(5 * scale), scale, "H细线");
            //PLPloter.CreateBreakLineP(db, ref ext, ptCB1.C2D(-5 * scale), ptCB2.C2D(5 * scale), scale, "H细线");
            PLPloter.CreateBreakLineP(db, ref ext, ptCB1.C2D(-5 * scale, cap), ptCB2.C2D(5 * scale, cap), scale, "H细线");
            PLPloter.AddLine(db,ptCB1, ptCB1E, ref ext, "H细线");
            PLPloter.AddLine(db,ptCB2, ptCB2E, ref ext, "H细线");
            PLPloter.AddLine(db,ptCB1E, ptCB2E, ref ext, "H细线");

            numR = (int)((BH - pierPara.pierRebar.pier_v_reinforcement_pilecap_depth) / pierPara.pierRebar.bottom_encryption_spacing);
            lenH = 0;
            if (BulkheadCount > 0)
            {
                for (int i = 0; i < numR; i++)
                {
                    if (i > 0)
                        lenH += pierPara.pierRebar.bottom_encryption_spacing;
                    if (isModify)
                    {
                        if (i % 3 == 0)
                            PLPloter.AddLine(db, ptCB1E.C2D(avg + lenH * pierPara.column.slope_l, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                    }
                    else
                    {
                        PLPloter.AddLine(db, ptCB1E.C2D(avg + lenH * pierPara.column.slope_l, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                    }
                }
            }
            else
            {
                numR = (int)((BH - pierPara.pierRebar.pier_v_reinforcement_pilecap_depth - 10 - 10 * pierPara.pierRebar.middle_encryption_spacing) / pierPara.pierRebar.bottom_encryption_spacing);

                for (int i = 0; i < numR; i++)
                {
                    if (i > 0)
                        lenH += pierPara.pierRebar.bottom_encryption_spacing;
                    if (isModify)
                    {
                        if (i % 3 == 0)
                            PLPloter.AddLine(db, ptCB1E.C2D(avg + lenH * pierPara.column.slope_l, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                    }
                    else
                    {
                        PLPloter.AddLine(db, ptCB1E.C2D(avg + lenH * pierPara.column.slope_l, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                    }
                    if (i == numR - 1)
                        ptDimB = ptCB1E.C3D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth);
                }
                for (int i = 0; i < 10; i++)
                {
                    lenH += pierPara.pierRebar.middle_encryption_spacing;
                    if (isModify)
                    {
                        if (i % 3 == 0)
                            PLPloter.AddLine(db, ptCB1E.C2D(avg + lenH * pierPara.column.slope_l, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                    }
                    else
                    {
                        PLPloter.AddLine(db, ptCB1E.C2D(avg + lenH * pierPara.column.slope_l, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                    }
                }
            }
            #endregion

            #region 内轮廓下部
            ptLst = new List<Point2d>();
            double BIH = botH + tH;
            //Point2d ptCB1IE = ptBottomC.C2D(-BottomW * 0.5+bottomThickness);
            //Point2d ptCB2IE = ptBottomC.C2D(BottomW * 0.5- bottomThickness);
            Point2d ptICB1 = ptCB1E.C2D(BH * pierPara.column.slope_l + bottomThickness, BH);
            Point2d ptICB2 = ptCB2E.C2D(-BH * pierPara.column.slope_l - bottomThickness, BH);
            Point2d ptICB3 = ptCB1E.C2D(BIH * pierPara.column.slope_l + bottomThickness, BIH);
            Point2d ptICB4 = ptCB2E.C2D(-BIH * pierPara.column.slope_l - bottomThickness, BIH);
            Point2d ptICB5 = ptICB3.C2D(tw, -tH);
            Point2d ptICB6 = ptICB4.C2D(-tw, -tH);
            ptLst.Add(ptICB1);
            ptLst.Add(ptICB3);
            ptLst.Add(ptICB5);
            ptLst.Add(ptICB6);
            ptLst.Add(ptICB4);
            ptLst.Add(ptICB2);
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);


            #endregion


            #region 承台外轮廓绘制
            double pileCapW = pierPara.column.top_l * 1.6; // pierPara.pileCap.pile_cap_length;
            double pileCapH = pierPara.pileCap.pile_cap_height > pierPara.pierRebar.pilecap_penetration_depth + 3 * scale ? pierPara.pileCap.pile_cap_height : (pierPara.pierRebar.pilecap_penetration_depth + 3 * scale);
            ptLst = new List<Point2d>();
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5));
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5));
            //PLPloter.AddPolylineByPointList(ptLst, ref ext, "H细线", true);


            #region 钢筋绘制
            int changeNum = 0;
            int midNum = 0;
            List<Point2d> ptGGTLst = new List<Point2d>();
            RebarArrangement.ArrangePointBySpace(ptSt, spancslLst, spancmlLst, lenL, BottomW - 2 * avg, out ptGGTLst, out changeNum, out midNum, pierPara.pierRebar.main_l_space);

            ptSt = ptBottomC.C2D(-BottomW * 0.5 + avg + BH * pierPara.column.slope_l, BH);
            stL = BottomW - 2 * avg - BH * pierPara.column.slope_l * 2;
            ptTLst = new List<Point2d>();
            //RebarArrangement.ArrangePoint(ptSt, spancslLst, spancmlLst, lenL, stL, out ptTLst, pierPara.pierRebar.main_l_change_num);
            RebarArrangement.ArrangePointNew(ptSt, spancslLst, spancmlLst, BottomW - 2 * avg, stL, out ptTLst,  pierPara.pierRebar.main_l_space);
            //RebarArrangement.ArrangePointBySpace(ptSt, spancslLst, spancmlLst, lenL, stL, out ptTLst,out changeNum,out midNum, pierPara.pierRebar.main_l_space);
            ptEnd = ptBottomC.C2D(-BottomW * 0.5 + avg - pierPara.pierRebar.pilecap_penetration_depth * pierPara.column.slope_l, -pierPara.pierRebar.pilecap_penetration_depth);
            endL = BottomW - 2 * avg + pierPara.pierRebar.pilecap_penetration_depth * pierPara.column.slope_l * 2;
            ptBLst = new List<Point2d>();
            //RebarArrangement.ArrangePoint(ptEnd, spancslLst, spancmlLst, lenL, endL, out ptBLst, pierPara.pierRebar.main_l_change_num);
            RebarArrangement.ArrangePointNew(ptEnd, spancslLst, spancmlLst, BottomW - 2 * avg, endL, out ptBLst,  pierPara.pierRebar.main_l_space);
            //RebarArrangement.ArrangePointBySpace(ptSt, spancslLst, spancmlLst,  lenL, endL, out ptBLst ,out changeNum,out midNum,pierPara.pierRebar.main_l_space);
            PLPloter.AddLine(db,ptSt, ptEnd, ref ext, "H钢筋");
            for (int m = 0; m < ptTLst.Count; m++)
            {
                PLPloter.AddLine(db,ptTLst[m], ptBLst[m], ref ext, "H钢筋");
            }
            #endregion

            //DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptDimT.C3D(), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebar.top_encryption_length / pierPara.pierRebar.top_encryption_spacing + "×" + pierPara.pierRebar.top_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptDimT.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "n1×" + pierPara.pierRebar.middle_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            if (pierPara.pierRebar.top_encryption_length > 0)
            {
                DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptDimT.C3D(), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebar.top_encryption_length / pierPara.pierRebar.top_encryption_spacing + "×" + pierPara.pierRebar.top_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptDimT.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "L-" + pierPara.pierRebar.top_encryption_length / pierPara.pierRebar.top_encryption_spacing + "×" + pierPara.pierRebar.top_encryption_spacing + "-" + pierPara.pierRebar.bottom_encryption_length / pierPara.pierRebar.bottom_encryption_spacing + "×" + pierPara.pierRebar.bottom_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, ptDimT.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "n1×" + pierPara.pierRebar.middle_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            }
            else
            {
                DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "n1×" + pierPara.pierRebar.middle_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            }
            DimPloter.DimRot(db, ptDimB.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebar.bottom_encryption_length / pierPara.pierRebar.bottom_encryption_spacing + "×" + pierPara.pierRebar.bottom_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            if (pierPara.pierRebar.pier_v_reinforcement_pilecap_depth > 0)
                DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);


            //DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBMid.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebar.beam_penetration_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebar.beam_penstration_layout, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBMid.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebar.beam_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, -pierPara.pierRebar.pilecap_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "H", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, -pierPara.pierRebar.pilecap_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);


            //string v = avg + "+" + dimLLString + "+" + pierPara.pierRebar.main_l_change_num + "×C" + "+" + dimLMString + "+" + pierPara.pierRebar.main_l_change_num + "×C" + "+" + dimLRString + "+" + avg;
            string v = avg + "+" + dimLLString + "+" + "C" + "+n×"+pierPara.pierRebar.main_l_space + "+"  + "C" + "+" + dimLRString + "+" + avg;
            DimPloter.DimRot(db, ptBottomC.C3D(-BottomW * 0.5), ptBottomC.C3D(BottomW * 0.5), ptBottomC.C3D(0, -pileCapH - 5 * scale), ref ext, 0, scale, v, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBottomC.C3D(-BottomW * 0.5), ptBottomC.C3D(BottomW * 0.5), ptBottomC.C3D(0, -pileCapH - 10 * scale), ref ext, 0, scale, "Bd1", Unit.Centimeter, Unit.Centimeter);

            #endregion

            double bLen = pierPara.column.top_l + 10 * pierPara.column.slope_l;
            List<double> lList = new List<double>();
            //lList.Add(bLen - avg * 2);
            //RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBMid.C3D(-bLen * 0.5 + avg, -10), ArrowDirection.West, new List<double>(), spanclLst, "1", scale, true, 4, 5 * scale);
            List<double> vb1aLst = new List<double>();
            List<double> vb1aLst1 = new List<double>();
            for (int i = 0; i < spanclLst.Count; i++)
            {
                if (i < spancslLst.Count)
                {
                    vb1aLst.Add(spanclLst[i]);
                }
                if (i > spanclLst.Count - 1 - spancslLst.Count)
                {
                    vb1aLst1.Add(spanclLst[i]);
                }
            }
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBMid.C3D(-bLen * 0.5 + avg, -10), ArrowDirection.East, new List<double>(), vb1aLst, "1a", scale, true, 5, 0 * scale);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBMid.C3D(bLen * 0.5 - avg- vb1aLst1.Sum(), -10), ArrowDirection.West, new List<double>(), vb1aLst1, "1a", scale, true, 5, 0 * scale);
            List<double> vb1Lst = new List<double>();
            double lenv = 0;
            for (int i = 0; i < spanclLst.Count; i++)
            {
                if (i > spancslLst.Count  && i < spanclLst.Count-1 - (spancslLst.Count))
                    vb1Lst.Add(spanclLst[i]);
            }
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBMid.C3D(-vb1Lst.Sum()*0.5, -50), ArrowDirection.West, new List<double>(), vb1Lst, "1b", scale, true, 15, 0 * scale);


            double vbl = BottomW - 2 * avg + (pierPara.pierRebar.pilecap_penetration_depth - 10) * pierPara.column.slope_l * 2;
            List<double> vbLst = new List<double>();
            //RebarArrangement.ArrangeSpan(spancslLst, spancmlLst, lenL, vbl, out vbLst, changeNum);
            RebarArrangement.ArrangeSpanBySpace(spancslLst, spancmlLst, BottomW - 2 * avg, vbl, out vbLst, pierPara.pierRebar.main_l_space);
            //List<double> vb1Lst = new List<double>();
            //double lenv = 0;
            vb1Lst = new List<double>();
            lenv = 0;
            double lee = 0;
            for (int i = 0; i < vbLst.Count; i++)
            {
                if (i > spancslLst.Count-1 + changeNum && i< vbLst.Count -1- (spancslLst.Count + changeNum))
                    vb1Lst.Add(vbLst[i]);          
            }
     
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBottomC.C3D(-(vbl) * 0.5+ spancslLst.Sum()+ vbLst[spancslLst.Count]+ changeNum* vbLst[spancslLst.Count+1], -pierPara.pierRebar.pilecap_penetration_depth + 10), ArrowDirection.West, new List<double>(), vb1Lst, "1b", scale, true, 15, 0 * scale);

            vbl = BottomW - 2 * avg + (pierPara.pierRebar.pilecap_penetration_depth - 60) * pierPara.column.slope_l * 2;
            vbLst = new List<double>();
            //RebarArrangement.ArrangeSpan(spancslLst, spancmlLst, lenL, vbl, out vbLst, changeNum);
            RebarArrangement.ArrangeSpanBySpace(spancslLst, spancmlLst, BottomW - 2 * avg, vbl, out vbLst, pierPara.pierRebar.main_l_space);
            //List<double> vb1aLst = new List<double>();
            //List<double> vb1aLst1 = new List<double>();
            vb1aLst = new List<double>();
            vb1aLst1 = new List<double>();
            for (int i = 0; i < vbLst.Count; i++)
            {
                if (i < spancslLst.Count)
                {
                     vb1aLst.Add(vbLst[i]);
                }
                if (i > vbLst.Count-1- spancslLst.Count)
                {
                    vb1aLst1.Add(vbLst[i]);
                }
            }
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBottomC.C3D(-vbl * 0.5 , -pierPara.pierRebar.pilecap_penetration_depth + 60), ArrowDirection.East, new List<double>(), vb1aLst, "1a", scale, true, 5, 0 * scale);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBottomC.C3D(vbl * 0.5-spancslLst.Sum(), -pierPara.pierRebar.pilecap_penetration_depth + 60), ArrowDirection.West, new List<double>(), vb1aLst1, "1a", scale, true, 10, 0 * scale);

            double vb2 = BottomW - 2 * avg + (pierPara.pierRebar.pilecap_penetration_depth - 90) * pierPara.column.slope_l * 2;
            List<double> vb20Lst = new List<double>();
            //RebarArrangement.ArrangeSpan(spancslLst, spancmlLst, lenL, vb2, out vb20Lst,changeNum);
            RebarArrangement.ArrangeSpanBySpace(spancslLst, spancmlLst, BottomW - 2 * avg, vb2, out vb20Lst, pierPara.pierRebar.main_l_space);
            double spChange = vb20Lst[spancslLst.Count];
            List<double> vb2Lst = new List<double>();
            double lenv2 = 0;
            double lenv3 = 0;
            for (int i = 0; i < vbLst.Count; i++)
            {
                if (i < spancslLst.Count)
                {
                    lenv2 += vbLst[i];
                }
                else if (i >= spancslLst.Count+1 && i < spancslLst.Count + changeNum)
                {
                    vb2Lst.Add(vbLst[i]);
                }
                else if (i >= spancslLst.Count + changeNum && i <= vbLst.Count - (spancslLst.Count + changeNum))
                {
                    lenv3 += vbLst[i];
                    if (i == vbLst.Count - (spancslLst.Count + changeNum))
                    {
                        vb2Lst.Add(lenv3);
                    }
                }
                else if (i >= vbLst.Count-1 - (spancslLst.Count + changeNum)  && i < vbLst.Count-1 - spancslLst.Count)
                {

                    vb2Lst.Add(vbLst[i]);
                }

            }
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBottomC.C3D(-vb2 * 0.5 + lenv2+ spChange, -pierPara.pierRebar.pilecap_penetration_depth + 90), ArrowDirection.West, new List<double>(), vb2Lst, "2", scale, true, 15, 5 * scale);

            lList = new List<double>();

            for (int i = 0; i < 5; i++)
            {
                lList.Add(pierPara.pierRebar.middle_encryption_spacing);
            }
            for (int i = 0; i < 5; i++)
            {
                lList.Add(pierPara.pierRebar.bottom_encryption_spacing);
            }
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptDimB.C3D(pierPara.column.top_l * 0.5 + 1 * scale * BulkheadCount+2, 5 * pierPara.pierRebar.middle_encryption_spacing), ArrowDirection.South, lList, new List<double>(), "5", scale, true, 1, pierPara.column.top_l * 0.5 + 5 * scale);
        }
        #endregion



        #region 第二页（点筋）
        //double lenN8 = 0;
        /// <summary>
        /// 立面A
        /// </summary>
        /// <param name="db"></param>
        /// <param name="ext"></param>
        /// <param name="insertPoint"></param>
        /// <param name="pierPara"></param>
        /// <param name="_scale"></param>
        public void PlotPierelEvationC(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "C-C", "", scale);
            Point2d pt = insertPoint.C2D(0, -3 * scale);

            double BeamW = pierPara.column.top_w * 1.5;
            Point3d ptDim = pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale);
            //Point3d ptDimL = pt.C3D(-BeamW * 0.5 - 10 * scale);
            Point3d ptDimL = pt.C3D(-BeamW * 0.5 - 20 * scale);
            //Point3d ptDimR = pt.C3D(pierPara.beam_w * 0.5 + 20 * scale);
            double halfPile = 15 * scale;//桩长示意长度
            double spaceLen = spancsLst.Sum();

            Point3d ptDimT = ptDim;
            Point3d ptDimB = ptDim;

            #region 盖梁外轮廓绘制

            double BeamH = pierPara.pierRebar.beam_penetration_depth + 4 * scale;
            //double BeamW = pierPara.column.top_w * 1.5;
            List<Point2d> ptLst = new List<Point2d>();
            Point2d pt1 = pt.C2D(-BeamW * 0.5);
            Point2d pt8 = pt.C2D(BeamW * 0.5);
            Point2d pt2 = pt1.C2D(0, -BeamH * 0.4);
            Point2d pt3 = pt.C2D(-pierPara.column.top_w * 0.5 - 15, -BeamH);
            Point2d pt4 = pt.C2D(-pierPara.column.top_w * 0.5, -BeamH);

            Point2d pt5 = pt4.C2D(pierPara.column.top_w);
            Point2d pt6 = pt5.C2D(15);
            Point2d pt7 = pt8.C2D(0, -BeamH * 0.4);

            ptLst.Add(pt1);
            ptLst.Add(pt2);
            ptLst.Add(pt3);
            ptLst.Add(pt4);
         
            Point2d ptBMid = pt.C2D(0, -BeamH);

            //PLPloter.AddPolylineByPointList(ptLst, ref ext, "H细线", false);
            ptLst = new List<Point2d>();
            ptLst.Add(pt5);
            ptLst.Add(pt6);
            ptLst.Add(pt7);
            ptLst.Add(pt8);
            //PLPloter.AddPolylineByPointList(ptLst, ref ext, "H细线", false);
            PLPloter.AddLine(db,pt4, pt5,ref ext,"H虚线");
            //PLPloter.CreateBreakLineP(db, ref ext, pt1, pt8, scale, "H细线");

            #region 钢筋绘制
            double total = 0;
            double lenW = Math.Round(spancwLst.Sum(), 1);
            double avg = sideOut;
            //for (int i = 0; i < spanBeamLst.Count - 1; i++)
            //{
            //    total += spanBeamLst[i];
            //    //PLPloter.AddLine(db,pt4.C2D(avg, total), pt5.C2D(-avg, total), ref ext, "H钢筋");
            //    PLPloter.AddLine(db,pt4.C2D(avg, total), pt4.C2D(avg + spaceLen, total), ref ext, "H钢筋");
            //    PLPloter.AddLine(db,pt5.C2D(-avg - spaceLen, total), pt5.C2D(-avg, total), ref ext, "H钢筋");
            //}

            #endregion

            #endregion


            #region 墩身轮廓绘制
            double cap = 2 * scale;
            //int BulkheadCount = 2;
            double columnH = (pierPara.h3 - pierPara.h2) * 100;
            //double angC = (pierPara.column.BottowW - pierPara.column.top_w)/(pierPara.h3- pierPara.h2);
            double topH = pierPara.column.top_solid_h;
            double botH = pierPara.column.bottom_solid_h;
            string[] sizeT = pierPara.column.section_w_ang.Split('*');
            string[] sizeM = pierPara.column.section_mid_w_ang.Split('*');
            string[] sizeBulk = pierPara.column.bulkhead_size_w.Split('*');
            string[] sizeBulkL = pierPara.column.bulkhead_size_l.Split('*');
            //double tH = double.Parse(sizeT[0]);
            //double tw = double.Parse(sizeT[1]);
            //double mH = double.Parse(sizeM[0]);
            //double mw = double.Parse(sizeM[1]);
            //double bH = double.Parse(sizeBulk[0]);
            //double bw = double.Parse(sizeBulk[1]);
            double tH = double.Parse(sizeT[1]);
            double tw = double.Parse(sizeT[0]);
            double mH = double.Parse(sizeM[1]);
            double mw = double.Parse(sizeM[0]);
            double bH = double.Parse(sizeBulk[1]);
            double bw = double.Parse(sizeBulk[0]);
            double bwL = double.Parse(sizeBulkL[0]);
            //double bwL = double.Parse(sizeBulkL[1]);

            #region 外轮廓上部
            //double FH = topH  + tH+25*scale;
            Point2d ptCF1 = ptBMid.C2D(-(pierPara.column.top_w * 0.5), -FH);
            Point2d ptCF2 = ptBMid.C2D((pierPara.column.top_w * 0.5), -FH);
            PLPloter.AddLine(db,pt4, ptCF1, ref ext, "H细线");
            PLPloter.AddLine(db,pt5, ptCF2, ref ext, "H细线");
            //if (pierPara.column.slope_w > 0)
            PLPloter.CreateBreakLineP(db, ref ext, ptCF1.C2D(-5 * scale), ptCF2.C2D(5 * scale), scale, "H细线");
            //else
            //    PLPloter.CreateBreakLineP(db, ref ext, ptCF1, ptCF2, scale, "H细线");

            //DimPloter.AddLRMark(db,"E", pt4.C3D(-6 * scale, -3.6 * scale), ref ext, scale, true);
            //DimPloter.AddLRMark(db,"E", pt5.C3D(6 * scale, -3.6 * scale), ref ext, scale, true);

            //DimPloter.AddLeft2RightBJ(db,"F", pt4.C3D(-6 * scale, -topH - tH - 5 * scale), ref ext, scale, 3, true);
            //DimPloter.AddLeft2RightBJ(db,"F", pt5.C3D(6 * scale, -topH - tH - 5 * scale), ref ext, scale, 3, false);
            #region 钢筋
            double len = 0;
            PLPloter.AddLine(db,ptCF1.C2D(avg, 0), pt4.C2D(avg, pierPara.pierRebar.beam_penetration_depth), ref ext, "H钢筋");
            for (int m = 0; m < spancwLst.Count; m++)
            {
                len += spancwLst[m];
                if (m == spancsLst.Count - 1 || m == spancwLst.Count - spancsLst.Count - 1 || m == spancwLst.Count - 1)
                    PLPloter.AddLine(db,ptCF1.C2D(avg + len), pt4.C2D(avg + len, pierPara.pierRebar.beam_penetration_depth), ref ext, "H钢筋");
            }
            int numR = (int)((FH-10-topH) / pierPara.pierRebar.top_encryption_spacing);
            double lenH = 10;
            int numRT= (int)((tH) / pierPara.pierRebar.top_encryption_spacing);
            Point2d ptICF1 = ptBMid.C2D(-pierPara.column.top_w * 0.5 + topThickness, -(topH + tH));
            Point2d ptICF2 = ptBMid.C2D(pierPara.column.top_w * 0.5 - topThickness, -(topH + tH));
            List<double> N9Lst = new List<double>();
            Point2d N9Pt = new Point2d();
            double ang = Math.Atan(tw / tH);
            Line lineA1 = new Line(ptICF1.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICF1.C2D(tw, tH).C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
            Line lineA2 = new Line(ptICF2.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICF2.C2D(-tw, tH).C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
            if (BulkheadCount > 0)
            {
                for (int i = 1; i <= numR; i++)
                {
                    lenH += pierPara.pierRebar.top_encryption_spacing;
                    if (i < numR - numRT)
                    {
                        if (isModify)
                        {
                            if (i % 3 == 0)
                            {
                                //PLPloter.AddLine(db,ptCF1.C2D(avg, lenH), ptCF2.C2D(-avg, lenH), ref ext, "H钢筋");

                                PLPloter.AddLine(db, ptCF1.C2D(avg, lenH), ptCF1.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptCF2.C2D(-avg - spaceLen, lenH), ptCF2.C2D(-avg, lenH), ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptCF1.C2D(avg, lenH), ptCF1.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptCF2.C2D(-avg - spaceLen, lenH), ptCF2.C2D(-avg, lenH), ref ext, "H钢筋");
                        }
                    }
                    else
                    {
                        //倒角位置
                        Line lineAT1 = new Line(ptCF1.C3D(avg, lenH), ptCF1.C3D(avg + spaceLen, lenH));
                        Line lineAT2 = new Line(ptCF2.C3D(-avg, lenH), ptCF2.C3D(-avg - spaceLen, lenH));
                        Point3d ptO1 = MathExtensions.GetIntersection(lineAT1, lineA1);
                        Point3d ptO2 = MathExtensions.GetIntersection(lineAT2, lineA2);
                        //PLPloter.AddLine(db,ptCF1.C2D(avg, lenH), ptCF1.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                        //PLPloter.AddLine(db,ptCF2.C2D(-avg - spaceLen, lenH), ptCF2.C2D(-avg, lenH), ref ext, "H钢筋");
                        if (isModify)
                        {
                            if (i % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptCF1.C2D(avg, lenH), ptO1.C2D(), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptCF2.C2D(-avg, lenH), ptO2.C2D(), ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptCF1.C2D(avg, lenH), ptO1.C2D(), ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptCF2.C2D(-avg, lenH), ptO2.C2D(), ref ext, "H钢筋");
                        }
                        N9Lst.Add(pierPara.pierRebar.top_encryption_spacing);
                        if (N9Lst.Count == numRT+1)
                            N9Pt = ptCF2.C2D(-avg - 10, lenH+ pierPara.pierRebar.top_encryption_spacing);
                    }
                }
            }
            else
            {
                numR = (int)((FH - 10 - 10 * pierPara.pierRebar.middle_encryption_spacing - topH) / pierPara.pierRebar.top_encryption_spacing);
                for (int i = 1; i <= 10; i++)
                {
                    lenH += pierPara.pierRebar.middle_encryption_spacing;
                    if (isModify)
                    {
                        if (i % 3 == 0)
                        {
                            PLPloter.AddLine(db, ptCF1.C2D(avg, lenH), ptCF1.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptCF2.C2D(-avg - spaceLen, lenH), ptCF2.C2D(-avg, lenH), ref ext, "H钢筋");
                        }
                    }
                    else
                    {
                        PLPloter.AddLine(db, ptCF1.C2D(avg, lenH), ptCF1.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                        PLPloter.AddLine(db, ptCF2.C2D(-avg - spaceLen, lenH), ptCF2.C2D(-avg, lenH), ref ext, "H钢筋");
                    }
                    if (i == 10)
                        ptDimT = ptCF1.C3D(avg, lenH);
                }
                for (int i = 1; i <= numR; i++)
                {
                    lenH += pierPara.pierRebar.top_encryption_spacing;
                    if (i < numR - numRT)
                    {
                        if (isModify)
                        {
                            if (i % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptCF1.C2D(avg, lenH), ptCF1.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptCF2.C2D(-avg - spaceLen, lenH), ptCF2.C2D(-avg, lenH), ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptCF1.C2D(avg, lenH), ptCF1.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptCF2.C2D(-avg - spaceLen, lenH), ptCF2.C2D(-avg, lenH), ref ext, "H钢筋");
                        }

                    }
                    else
                    {
                        Line lineAT1 = new Line(ptCF1.C3D(avg, lenH), ptCF1.C3D(avg + spaceLen, lenH));
                        Line lineAT2 = new Line(ptCF2.C3D(-avg, lenH), ptCF2.C3D(-avg - spaceLen, lenH));
                        Point3d ptO1 = MathExtensions.GetIntersection(lineAT1, lineA1);
                        Point3d ptO2 = MathExtensions.GetIntersection(lineAT2, lineA2);
                        if (isModify)
                        {
                            if (i % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptCF1.C2D(avg, lenH), ptO1.C2D(), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptCF2.C2D(-avg, lenH), ptO2.C2D(), ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptCF1.C2D(avg, lenH), ptO1.C2D(), ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptCF2.C2D(-avg, lenH), ptO2.C2D(), ref ext, "H钢筋");
                        }
                        N9Lst.Add(pierPara.pierRebar.top_encryption_spacing);
                        if (N9Lst.Count == numRT + 1)
                            N9Pt = ptCF2.C2D(-avg - 10, lenH + pierPara.pierRebar.top_encryption_spacing);
                    }
                }
            }

            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, N9Pt.C3D(), ArrowDirection.South, N9Lst, new List<double>(), "9", scale, false, 5, 3 * scale);
            #endregion

            #endregion

            #region 内轮廓上部

            Point2d ptIC = ptBMid.C2D();
            //Point2d ptICF1 = ptBMid.C2D(-pierPara.column.top_w * 0.5 + topThickness, -(topH + tH));
            //Point2d ptICF2 = ptBMid.C2D(pierPara.column.top_w * 0.5 - topThickness, -(topH + tH));
            ptLst = new List<Point2d>();
            ptLst.Add(ptCF1.C2D(topThickness));
            ptLst.Add(ptICF1.C2D());
            ptLst.Add(ptICF1.C2D(tw, tH));
            ptLst.Add(ptICF2.C2D(-tw, tH));
            ptLst.Add(ptICF2.C2D());
            ptLst.Add(ptCF2.C2D(-topThickness));
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);

            //List<Point3d> treLst;
            //List<double> lst = new List<double>();
            //double le = spancmLst.Sum();
            //for (int m = 0; m < spancaLst.Count; m++)
            //{
            //    if (m == 0)
            //        lst.Add(spancaLst[m] - radius);
            //    else
            //        lst.Add(spancaLst[m]);
            //}
            //for (int m = 0; m < spancmLst.Count; m++)
            //{
            //    lst.Add(spancmLst[m]);
            //}
            //for (int m = 0; m < spancaLst.Count; m++)
            //{
            //    if (m == spancaLst.Count - 1)
            //        lst.Add(spancaLst[m] - radius);
            //    else
            //        lst.Add(spancaLst[m]);
            //}
            //le = lst.Sum();
            //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, ptIC.C2D(-le*0.5, -topH + pierPara.pierRebar.concrete_protect_layer),
            //    radius, lst, scale, 0, out treLst, false);
            //PLPloter.AddLine(db,ptIC.C2D(-le * 0.5-radius, -topH + pierPara.pierRebar.concrete_protect_layer + radius), ptIC.C2D(le * 0.5+ radius, -topH + pierPara.pierRebar.concrete_protect_layer + radius), ref ext, "H钢筋");

            //List<Point2d> ptTCLst = new List<Point2d>();
            Point2d ptTC = ptIC.C2D(-pierPara.column.top_w * 0.5 + avg, -(topH - pierPara.pierRebar.concrete_protect_layer));
            double endTCL = pierPara.column.top_w - avg * 2;
            List<Point3d> ptHLst = new List<Point3d>();
            List<double> ptHSLst = new List<double>();
            string spH = "";
            SteelBarPileCap.CreateAvgCircleHatchList(db, ref ext, ptTC.C2D(spaceLen + radius+tw+ pierPara.pierRebar.pier_protect_layer),
               radius, endTCL - spaceLen * 2 - radius * 2 - 2 * tw - 2 * pierPara.pierRebar.pier_protect_layer, endTCL - spaceLen * 2 - radius * 2-2* tw - 2 * pierPara.pierRebar.pier_protect_layer, pierPara.pierRebar.pier_solid_reinforcement_space, 0, radius, out ptHLst, out ptHSLst, out spH, eDirection.E_TOP, true);
            PLPloter.AddLine(db,ptTC, ptTC.C2D(endTCL), ref ext, "H钢筋");

            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_BOTTOM, ptHLst, "6", ptHLst.Count / 8, ptHLst.Count / 8, scale, false, 6 * scale);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptHLst[ptHLst.Count / 2].C3D(radius * 3, -radius), ArrowDirection.North, new List<double>(), new List<double>(), "6a", scale, true, scale, 0 * scale);

            List<Point2d> ptBeamCLst = new List<Point2d>();
            List<Point2d> ptN7Lst = new List<Point2d>();
            List<double> spaceN7Lst = new List<double>();

            for (int i = 0; i < ptHLst.Count; i++)
            {

                if ((i) % 3 == 0 || i == ptHLst.Count - 1)
                {
                    if (i == ptHLst.Count - 1)
                    {
                        PLPloter.AddLine(db,ptHLst[i].C2D(radius), ptHLst[i].C2D(radius, pierPara.pierRebar.beam_penetration_depth + (topH - pierPara.pierRebar.concrete_protect_layer)), ref ext, "H钢筋");
                        Line liN7 = new Line(ptHLst[i].C3D(radius), ptHLst[i].C3D(radius, pierPara.pierRebar.beam_penetration_depth + (topH - pierPara.pierRebar.concrete_protect_layer)));
                        Point2d ptN7D = MathExtensions.GetPointOnTheLine(ptHLst[i].C2D(radius), ptHLst[i].C2D(radius, pierPara.pierRebar.beam_penetration_depth + (topH - pierPara.pierRebar.concrete_protect_layer)), liN7.Length - 40);
                        ptN7Lst.Add(ptN7D);
                    }
                    else
                    {
                        PLPloter.AddLine(db,ptHLst[i].C2D(-radius), ptHLst[i].C2D(-radius, pierPara.pierRebar.beam_penetration_depth + (topH - pierPara.pierRebar.concrete_protect_layer)), ref ext, "H钢筋");
                        Line liN7 = new Line(ptHLst[i].C3D(-radius), ptHLst[i].C3D(-radius, pierPara.pierRebar.beam_penetration_depth + (topH - pierPara.pierRebar.concrete_protect_layer)));
                        Point2d ptN7D = MathExtensions.GetPointOnTheLine(ptHLst[i].C2D(-radius), ptHLst[i].C2D(-radius, pierPara.pierRebar.beam_penetration_depth + (topH - pierPara.pierRebar.concrete_protect_layer)), liN7.Length - 40);
                        ptN7Lst.Add(ptN7D);
                    }
                    if (ptN7Lst.Count > 1)
                    {
                        spaceN7Lst.Add(ptN7Lst[ptN7Lst.Count - 1].X - ptN7Lst[ptN7Lst.Count - 2].X);
                    }

                }

            }
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptN7Lst[0].C3D(), ArrowDirection.West, new List<double>(), spaceN7Lst, "7", scale, true, 8, 0 * scale);
            N7N = ptN7Lst.Count*4;
            PLPloter.AddLine(db,ptTC.C2D(0,45), ptTC.C2D(endTCL, 45), ref ext, "H钢筋");
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptTC.C2D(topThickness * 0.6, 45).C3D(), ArrowDirection.South, new List<double>(), new List<double>(), "8", scale, true, 5, 0 * scale);
            #region 3#，10a#

            Line l1 = new Line(ptICF1.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICF1.C2D(tw, tH).C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
            double lenLine = l1.Length;

            Line lOut1 = new Line(pt4.C3D(avg), ptCF1.C3D(avg));


            Point3d ptOut = MathExtensions.GetIntersection(l1, lOut1);
            Line lOut = new Line(ptOut, l1.StartPoint);
            lenN3 = lOut.Length;
            Point3d p1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine + lOut.Length).C3D();
            Point3d p2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lOut.Length).C3D();
            lenN3T = lenN3;
            if(p1.Y>ptBMid.Y)
            {
                Line lineB = new Line(ptBMid.C3D(-pierPara.column.top_w*0.5,-pierPara.pierRebar.pier_protect_layer), ptBMid.C3D(pierPara.column.top_w * 0.5, -pierPara.pierRebar.pier_protect_layer));
                p1 = MathExtensions.GetIntersection(lineB, l1);
                Line lineS= new Line(ptOut.C3D(), p1.C3D());
                lenN3T = lineS.Length - lenLine- lenN3;
            }
            PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            Line lineN8 = new Line(p1.C3D(), p2.C3D());
            lenN3All = lineN8.Length;
            List<Point3d> ptALst = new List<Point3d>();
            for (int i = 0; i < lenN3/pierPara.pierRebar.pier_angle_reinforcement_space ; i++)
            {
                double lenDiv = (lenLine - 2 * radius) * i / (lenN3 / pierPara.pierRebar.pier_angle_reinforcement_space);
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenDiv + radius).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptALst.Add(pp1);
            }
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);

            Point3d ptN8 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenLine * 0.2).C3D();
            RebarDimPloter.CreateHookLineMark(db, ref ext, ptN8, "3a", 3 * scale, scale, 360 - GeTools.RadianToDegree(ang));
            RebarDimPloter.CreateHookLineMark(db, ref ext, ptALst[ptALst.Count / 2], ptALst, "10a", 3 * scale, scale, 360 - GeTools.RadianToDegree(ang));

            Line l2 = new Line(ptICF2.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICF2.C2D(-tw, tH).C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
            double lenLine2 = l2.Length;
  
            p1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenLine + lenN3T).C3D();
            p2 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), -lOut.Length).C3D();
          
            PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            ptALst = new List<Point3d>();
            for (int i = 0; i < lenN3 / pierPara.pierRebar.pier_angle_reinforcement_space; i++)
            {
                double lenDiv = (lenLine2 - 2 * radius) * i / (lenN3 / pierPara.pierRebar.pier_angle_reinforcement_space);
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenDiv + radius).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptALst.Add(pp1);
            }
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);
            #endregion

            #endregion

            #region 外轮廓中部
            //double MH = 40*scale  + mH*2+ bH;
            Point2d ptCM1 = ptCF1.C2D(0, -cap);
            Point2d ptCM2 = ptCF2.C2D(0, -cap);
            Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_w, -cap - MH);
            Point2d ptCM2E = ptCF2.C2D((MH) * pierPara.column.slope_w, -cap - MH);

            ptDimB = ptCM1E.C3D(avg, -FH * 0.35);
            if (BulkheadCount==0)
            {
                ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_w,  - MH);
                ptCM2E = ptCF2.C2D((MH) * pierPara.column.slope_w,  - MH);
            }
            if (pierPara.column.slope_w > 0)
            {
                TextPloter.AddDBText(db,ptCM2.C3D(6 * scale, -10 * scale), ref ext, "1:" + 1 / pierPara.column.slope_w, scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90));
            }
            for (int i = 0; i < BulkheadCount; i++)
            {
                ptCM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_w, -cap * (i + 1) - MH * i);
                ptCM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_w, -cap * (i + 1) - MH * i);
                ptCM1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_w, -cap * (i + 1) - MH * (i + 1));
                ptCM2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_w, -cap * (i + 1) - MH * (i + 1));
                //if(pierPara.column.slope_w>0)
                PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(-5 * scale), ptCM2.C2D(5 * scale), scale, "H细线");
                //else
                //     PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(), ptCM2.C2D(), scale, "H墩身");
                PLPloter.AddLine(db,ptCM1, ptCM1E, ref ext, "H细线");
                PLPloter.AddLine(db,ptCM2, ptCM2E, ref ext, "H细线");
                //if (pierPara.column.slope_w > 0)
                PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale), ptCM2E.C2D(5 * scale), scale, "H细线");
                //else
                //    PLPloter.CreateBreakLineP(db, ref ext, ptCM1E, ptCM2E, scale, "H墩身");

                #region 钢筋
                len = 0;
                PLPloter.AddLine(db,ptCM1.C2D(avg), ptCM1E.C2D(avg), ref ext, "H钢筋");
                for (int m = 0; m < spancwLst.Count; m++)
                {
                    len += spancwLst[m];
                    if (m == spancsLst.Count - 1 || m == spancwLst.Count - spancsLst.Count - 1 || m == spancwLst.Count - 1)
                        PLPloter.AddLine(db,ptCM1.C2D(avg + len), ptCM1E.C2D(avg + len), ref ext, "H钢筋");
                }

                if (BulkheadCount > 1)
                {
                    if (i == 0)
                    {
                        numR = (int)((MH - pierPara.pierRebar.top_encryption_spacing * 10) / pierPara.pierRebar.middle_encryption_spacing);
                        lenH = 0;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebar.top_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1.C2D(avg, -lenH), ptCM2.C2D(-avg, -lenH), ref ext, "H钢筋");
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                {
                                    PLPloter.AddLine(db, ptCM1.C2D(avg, -lenH), ptCM1.C2D(avg + spaceLen, -lenH), ref ext, "H钢筋");
                                    PLPloter.AddLine(db, ptCM2.C2D(-avg - spaceLen, -lenH), ptCM2.C2D(-avg, -lenH), ref ext, "H钢筋");
                                }
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptCM1.C2D(avg, -lenH), ptCM1.C2D(avg + spaceLen, -lenH), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptCM2.C2D(-avg - spaceLen, -lenH), ptCM2.C2D(-avg, -lenH), ref ext, "H钢筋");
                            }
                            if (m == 10)
                                ptDimT = ptCM1.C3D(avg, -lenH);
                        }
                        for (int m = 1; m <= numR; m++)
                        {
                            lenH += pierPara.pierRebar.middle_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1.C2D(avg, -lenH), ptCM2.C2D(-avg, -lenH), ref ext, "H钢筋");
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                {
                                    PLPloter.AddLine(db, ptCM1.C2D(avg, -lenH), ptCM1.C2D(avg + spaceLen, -lenH), ref ext, "H钢筋");
                                    PLPloter.AddLine(db, ptCM2.C2D(-avg - spaceLen, -lenH), ptCM2.C2D(-avg, -lenH), ref ext, "H钢筋");
                                }
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptCM1.C2D(avg, -lenH), ptCM1.C2D(avg + spaceLen, -lenH), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptCM2.C2D(-avg - spaceLen, -lenH), ptCM2.C2D(-avg, -lenH), ref ext, "H钢筋");
                            }
                        }
                    }
                    else if (i == BulkheadCount - 1)
                    {
                        numR = (int)((MH - pierPara.pierRebar.bottom_encryption_spacing * 10) / pierPara.pierRebar.middle_encryption_spacing);
                        lenH = 0;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebar.bottom_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                {
                                    PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                                    PLPloter.AddLine(db, ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                                }
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            }

                            if (m == 10)
                                ptDimB = ptCM1E.C3D(avg, lenH);
                        }
                        for (int m = 1; m <= numR; m++)
                        {
                            lenH += pierPara.pierRebar.middle_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                {
                                    PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                                    PLPloter.AddLine(db, ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                                }
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            }
                        }
                    }
                    else
                    {
                        //numR = (int)((MH - pierPara.pierRebar.bottom_encryption_spacing * 10 - pierPara.pierRebar.top_encryption_spacing * 10-10) / pierPara.pierRebar.middle_encryption_spacing);
                        numR = (int)((MH -  10) / pierPara.pierRebar.middle_encryption_spacing);
                        lenH = 10;
                        //for (int m = 1; m <= 10; m++)
                        //{
                        //    lenH += pierPara.pierRebar.bottom_encryption_spacing;
                        //    //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                        //    PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                        //    PLPloter.AddLine(db,ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                        //    if (m == 10)
                        //        ptDimB = ptCM1E.C3D(avg, lenH);
                        //}
                        for (int m = 1; m <= numR; m++)
                        {
                            lenH += pierPara.pierRebar.middle_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                {
                                    PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                                    PLPloter.AddLine(db, ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                                }
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            }
                        }
                        //for (int m = 1; m <= 10; m++)
                        //{
                        //    lenH += pierPara.pierRebar.top_encryption_spacing;
                        //    //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                        //    PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                        //    PLPloter.AddLine(db,ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                        //    if (m == 1)
                        //        ptDimT = ptCM1E.C3D(avg, lenH);
                        //}
                    }
                }
                else
                {
                    numR = (int)((MH - pierPara.pierRebar.bottom_encryption_spacing * 10 - pierPara.pierRebar.top_encryption_spacing * 10) / pierPara.pierRebar.middle_encryption_spacing);
                    lenH = 0;
                    for (int m = 1; m <= 10; m++)
                    {
                        lenH += pierPara.pierRebar.bottom_encryption_spacing;
                        //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        if (isModify)
                        {
                            if (m % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        }

                        if (m == 10)
                            ptDimB = ptCM1E.C3D(avg, lenH);
                    }
                    for (int m = 1; m <= numR; m++)
                    {
                        lenH += pierPara.pierRebar.middle_encryption_spacing;
                        //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        if (isModify)
                        {
                            if (m % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        }
                    }
                    for (int m = 1; m <= 10; m++)
                    {
                        lenH += pierPara.pierRebar.top_encryption_spacing;
                        //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        if (isModify)
                        {
                            if (m % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        }
                        if (m == 1)
                            ptDimT = ptCM1E.C3D(avg, lenH);
                    }
                }
                #endregion
            }
            #endregion

            #region 内轮廓中部
            Point2d ptICM = ptBMid.C2D(0, -FH - cap);
            Point2d ptICM1 = ptCF1.C2D(0, -cap);
            Point2d ptICM2 = ptCF2.C2D(0, -cap);
            double HB = (MH - mH * 2 - bH) * 0.5;
            //Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_w, -cap - MH);
            for (int i = 0; i < BulkheadCount; i++)
            {
                ptLst = new List<Point2d>();
                ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i - HB - mH);
                ptICM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * i);
                ptICM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * i);
                Point2d ptICM3 = ptCF1.C2D(-(MH * i + HB) * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * i - HB);
                Point2d ptICM4 = ptCF2.C2D((MH * i + HB) * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * i - HB);
                Point2d ptICM5 = ptICM3.C2D(mw, -mH);
                Point2d ptICM6 = ptICM4.C2D(-mw, -mH);
                ptLst.Add(ptICM1);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM.C2D(-bw * 0.5));
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);

                ptLst = new List<Point2d>();
                ptLst.Add(ptICM.C2D(bw * 0.5));
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptICM2);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);
                //PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(bw * 0.5),ref ext,"H虚线");
                //Point3d ptMM = GeTools.MidPoint(ptICM3.C3D(), ptICM5.C3D());
                //DimPloter.AddMLeader(db,ptMM.C2D(), ptMM.C2D(2 * scale, 5 * scale), pierPara.column.section_mid_w_ang, ref ext, scale);
                #region 隔板

                PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(-bw * 0.5, -bH), ref ext, "H细线");
                PLPloter.AddLine(db,ptICM.C2D(bw * 0.5), ptICM.C2D(bw * 0.5, -bH), ref ext, "H细线");

                #endregion

                ptLst = new List<Point2d>();
                Point2d ptCMI1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * (i + 1));
                Point2d ptCMI2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * (i + 1));
                ptICM3 = ptCF1.C2D(-(MH * i + HB + mH * 2 + bH) * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                ptICM4 = ptCF2.C2D((MH * i + HB + mH * 2 + bH) * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                ptICM5 = ptICM3.C2D(mw, mH);
                ptICM6 = ptICM4.C2D(-mw, mH);
                ptLst.Add(ptCMI1E);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM.C2D(-bw * 0.5, -bH));
                //ptLst.Add(ptICM6);
                //ptLst.Add(ptICM4);
                //ptLst.Add(ptCMI2E);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);

                ptLst = new List<Point2d>();
                ptLst.Add(ptICM.C2D(bw * 0.5, -bH));
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptCMI2E);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);

                //PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5, -bH), ptICM.C2D(bw * 0.5, -bH), ref ext, "H虚线");

            }




            #endregion

            //DimPloter.AddLRMark(db,"F", ptDimB.C3D(-6 * scale, -3 * scale), ref ext, scale, true);
            //DimPloter.AddLRMark(db,"F", ptDimB.C3D(6 * scale + pierPara.column.top_w, -3 * scale), ref ext, scale, true);
            #region 外轮廓下部
            //double BH = botH  + tH +25*scale;
            Point2d ptBottomC = new Point2d(ptBMid.X, ptCM2E.Y - cap - BH);
            double BottomW = pierPara.column.top_w + pierPara.pier_height * 100 * pierPara.column.slope_w;

            Point2d ptCB1E = ptBottomC.C2D(-BottomW * 0.5);
            Point2d ptCB2E = ptBottomC.C2D(BottomW * 0.5);
            Point2d ptCB1 = ptCB1E.C2D(BH * pierPara.column.slope_w, BH);
            Point2d ptCB2 = ptCB2E.C2D(-BH * pierPara.column.slope_w, BH);
            PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale, -cap), ptCM2E.C2D(5 * scale, -cap), scale, "H细线");
            PLPloter.AddLine(db,ptCB1, ptCB1E, ref ext, "H细线");
            PLPloter.AddLine(db,ptCB2, ptCB2E, ref ext, "H细线");
            PLPloter.AddLine(db,ptCB1E, ptCB2E, ref ext, "H细线");

            double BIH = botH + tH;
            //Point2d ptCB1IE = ptBottomC.C2D(-BottomW * 0.5+bottomThickness);
            //Point2d ptCB2IE = ptBottomC.C2D(BottomW * 0.5- bottomThickness);
            Point2d ptICB1 = ptCB1E.C2D(BH * pierPara.column.slope_w + topThickness, BH);
            Point2d ptICB2 = ptCB2E.C2D(-BH * pierPara.column.slope_w - topThickness, BH);
            Point2d ptICB3 = ptCB1E.C2D(BIH * pierPara.column.slope_w + topThickness, BIH);
            Point2d ptICB4 = ptCB2E.C2D(-BIH * pierPara.column.slope_w - topThickness, BIH);
            Point2d ptICB5 = ptICB3.C2D(tw, -tH);
            Point2d ptICB6 = ptICB4.C2D(-tw, -tH);

            N9Lst = new List<double>();
            N9Pt = new Point2d();
            numR = (int)((BH - pierPara.pierRebar.pier_v_reinforcement_pilecap_depth-botH) / pierPara.pierRebar.bottom_encryption_spacing);
            int numRB = (int)((tH) / pierPara.pierRebar.bottom_encryption_spacing);
            Line lineAB1 = new Line(ptICB3.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICB5.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
            Line lineAB2 = new Line(ptICB4.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICB6.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
            lenH = botH;
            if (BulkheadCount > 0)
            {
                for (int i = 0; i < numR; i++)
                {
                    if (i > 0)
                        lenH += pierPara.pierRebar.bottom_encryption_spacing;
                    if (i < numRB)
                    {
                        Line lineAB11 = new Line(ptCB1E.C3D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB1E.C3D(avg + spaceLen, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth));
                        Line lineAB12 = new Line(ptCB2E.C3D(-avg - spaceLen, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C3D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth));
                        Point3d ptO1 = MathExtensions.GetIntersection(lineAB1, lineAB11);
                        Point3d ptO2 = MathExtensions.GetIntersection(lineAB2, lineAB12);
                        //PLPloter.AddLine(db,ptCF1.C2D(avg, lenH), ptCF1.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                        //PLPloter.AddLine(db,ptCF2.C2D(-avg - spaceLen, lenH), ptCF2.C2D(-avg, lenH), ref ext, "H钢筋");
                        if (isModify)
                        {
                            if (i % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptCB1E.C2D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptO1.C2D(), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptCB2E.C2D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptO2.C2D(), ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptCB1E.C2D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptO1.C2D(), ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptCB2E.C2D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptO2.C2D(), ref ext, "H钢筋");
                        }
                        //if (N9Lst.Count < numRB - 1)
                            N9Lst.Add(pierPara.pierRebar.bottom_encryption_spacing);
                        if (N9Lst.Count == numRB)
                            N9Pt = ptCB2E.C2D(-avg - 10, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth);
                    }
                    else
                    {
                        //PLPloter.AddLine(db,ptCB1E.C2D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                        if (isModify)
                        {
                            if (i % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptCB1E.C2D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB1E.C2D(avg + spaceLen, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptCB2E.C2D(-avg - spaceLen, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptCB1E.C2D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB1E.C2D(avg + spaceLen, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptCB2E.C2D(-avg - spaceLen, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                        }
                    }
                }
            }
            else
            {
                numR = (int)((BH - pierPara.pierRebar.pier_v_reinforcement_pilecap_depth - 10 - 10 * pierPara.pierRebar.middle_encryption_spacing - botH) / pierPara.pierRebar.bottom_encryption_spacing);

                for (int i = 0; i < numR; i++)
                {
                    if (i > 0)
                        lenH += pierPara.pierRebar.bottom_encryption_spacing;
                    if (i < numRB)
                    {
                        Line lineAB11 = new Line(ptCB1E.C3D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB1E.C3D(avg + spaceLen, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth));
                        Line lineAB12 = new Line(ptCB2E.C3D(-avg - spaceLen, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C3D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth));
                        Point3d ptO1 = MathExtensions.GetIntersection(lineAB1, lineAB11);
                        Point3d ptO2 = MathExtensions.GetIntersection(lineAB2, lineAB12);
                        //PLPloter.AddLine(db,ptCF1.C2D(avg, lenH), ptCF1.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                        //PLPloter.AddLine(db,ptCF2.C2D(-avg - spaceLen, lenH), ptCF2.C2D(-avg, lenH), ref ext, "H钢筋");
                        if (isModify)
                        {
                            if (i % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptCB1E.C2D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptO1.C2D(), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptCB2E.C2D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptO2.C2D(), ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptCB1E.C2D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptO1.C2D(), ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptCB2E.C2D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptO2.C2D(), ref ext, "H钢筋");
                        }
                        //if (N9Lst.Count < numRB - 1)
                            N9Lst.Add(pierPara.pierRebar.bottom_encryption_spacing);
                        if (N9Lst.Count == numRB)
                            N9Pt = ptCB2E.C2D(-avg - 10, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth);
                    }
                    else
                    {
                        if (isModify)
                        {
                            if (i % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptCB1E.C2D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB1E.C2D(avg + spaceLen, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptCB2E.C2D(-avg - spaceLen, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptCB1E.C2D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB1E.C2D(avg + spaceLen, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptCB2E.C2D(-avg - spaceLen, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                        }
                        if (i == numR - 1)
                            ptDimB = ptCB1E.C3D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth);
                    }
                }
                for (int i = 0; i < 10; i++)
                {
                    lenH += pierPara.pierRebar.middle_encryption_spacing;
                    if (isModify)
                    {
                        if (i % 3 == 0)
                        {
                            PLPloter.AddLine(db, ptCB1E.C2D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB1E.C2D(avg + spaceLen, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptCB2E.C2D(-avg - spaceLen, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                        }
                    }
                    else
                    {
                        PLPloter.AddLine(db, ptCB1E.C2D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB1E.C2D(avg + spaceLen, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                        PLPloter.AddLine(db, ptCB2E.C2D(-avg - spaceLen, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                    }
                }
            }
            //DimPloter.AddLRMark(db,"G", ptBottomC.C3D(-6 * scale - pierPara.column.top_w * 0.5, 0 * scale), ref ext, scale, false);
            //DimPloter.AddLRMark(db,"G", ptBottomC.C3D(10 * scale + pierPara.column.top_w*0.5, 0 * scale), ref ext, scale, false);
            //DimPloter.AddLeft2RightBJ(db,"G", ptCB1E.C3D(-6 * scale, botH * 0.5), ref ext, scale, 3, true);
            //DimPloter.AddLeft2RightBJ(db,"G", ptCB2E.C3D(6 * scale, botH * 0.5), ref ext, scale, 3, false);

            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, N9Pt.C3D(), ArrowDirection.North, N9Lst, new List<double>(), "9", scale, false, 5, 5 * scale);
            #endregion

            #region 内轮廓下部
            ptLst = new List<Point2d>();
            //double BIH = botH + tH;
            ////Point2d ptCB1IE = ptBottomC.C2D(-BottomW * 0.5+bottomThickness);
            ////Point2d ptCB2IE = ptBottomC.C2D(BottomW * 0.5- bottomThickness);
            //Point2d ptICB1 = ptCB1E.C2D(BH * pierPara.column.slope_w + topThickness, BH);
            //Point2d ptICB2 = ptCB2E.C2D(-BH * pierPara.column.slope_w - topThickness, BH);
            //Point2d ptICB3 = ptCB1E.C2D(BIH * pierPara.column.slope_w + topThickness, BIH);
            //Point2d ptICB4 = ptCB2E.C2D(-BIH * pierPara.column.slope_w - topThickness, BIH);
            //Point2d ptICB5 = ptICB3.C2D(tw, -tH);
            //Point2d ptICB6 = ptICB4.C2D(-tw, -tH);
            ptLst.Add(ptICB1);
            ptLst.Add(ptICB3);
            ptLst.Add(ptICB5);
            ptLst.Add(ptICB6);
            ptLst.Add(ptICB4);
            ptLst.Add(ptICB2);
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);

            //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, ptBottomC.C2D(-le * 0.5, botH - pierPara.pierRebar.concrete_protect_layer - radius),
            //  radius, lst, scale, 0, out treLst, false);
            //PLPloter.AddLine(db,ptBottomC.C2D(-le * 0.5 - radius, botH - pierPara.pierRebar.concrete_protect_layer), ptBottomC.C2D(le * 0.5 + radius, botH - pierPara.pierRebar.concrete_protect_layer ), ref ext, "H钢筋");

            Point2d ptBC = ptBottomC.C2D(-pierPara.column.top_w * 0.5 + avg, (botH - pierPara.pierRebar.concrete_protect_layer));
            double endBCL = pierPara.column.top_w - avg * 2;
            List<Point3d> ptHBLst = new List<Point3d>();
            List<double> ptHSBLst = new List<double>();
            string spBH = "";
            SteelBarPileCap.CreateAvgCircleHatchList(db, ref ext, ptBC.C2D(spaceLen + radius+tw+ pierPara.pierRebar.pier_protect_layer),
               radius, endBCL - spaceLen * 2 - radius * 2- 2 * tw - 2 * pierPara.pierRebar.pier_protect_layer, endTCL - spaceLen * 2 - radius * 2- 2 * tw - 2 * pierPara.pierRebar.pier_protect_layer, pierPara.pierRebar.pier_solid_reinforcement_space, 0, radius, out ptHBLst, out ptHSBLst, out spBH, eDirection.E_BOTTOM, true);
            PLPloter.AddLine(db,ptBC, ptBC.C2D(endBCL), ref ext, "H钢筋");

            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_TOP, ptHBLst, "6", ptHBLst.Count / 8, ptHBLst.Count / 8, scale, false, 5 * scale);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptHBLst[ptHBLst.Count / 2].C3D(radius * 3, radius), ArrowDirection.South, new List<double>(), new List<double>(), "6a", scale, true, scale, 0 * scale);

            List<Point2d> ptCapCLst = new List<Point2d>();
            List<Point2d> ptN7ALst = new List<Point2d>();
            List<double> spaceN7ALst = new List<double>();

            for (int i = 0; i < ptHBLst.Count; i++)
            {
                if ((i) % 3 == 0 || i == ptHBLst.Count - 1)
                {
                    if (i == ptHBLst.Count - 1)
                    {
                        PLPloter.AddLine(db,ptHBLst[i].C2D(radius), ptHBLst[i].C2D(radius, -pierPara.pierRebar.pilecap_penetration_depth - (topH - pierPara.pierRebar.concrete_protect_layer)), ref ext, "H钢筋");
                        Line liN7 = new Line(ptHBLst[i].C3D(radius), ptHBLst[i].C3D(radius, -pierPara.pierRebar.pilecap_penetration_depth - (topH - pierPara.pierRebar.concrete_protect_layer)));
                        Point2d ptN7D = MathExtensions.GetPointOnTheLine(ptHBLst[i].C2D(radius), ptHBLst[i].C2D(radius, -pierPara.pierRebar.pilecap_penetration_depth - (topH - pierPara.pierRebar.concrete_protect_layer)), liN7.Length - 40);
                        ptN7ALst.Add(ptN7D);
                    }
                    else
                    {
                        PLPloter.AddLine(db,ptHBLst[i].C2D(-radius), ptHBLst[i].C2D(-radius, -pierPara.pierRebar.pilecap_penetration_depth - (topH - pierPara.pierRebar.concrete_protect_layer)), ref ext, "H钢筋");
                        Line liN7 = new Line(ptHBLst[i].C3D(-radius), ptHBLst[i].C3D(-radius, -pierPara.pierRebar.pilecap_penetration_depth - (topH - pierPara.pierRebar.concrete_protect_layer)));
                        Point2d ptN7D = MathExtensions.GetPointOnTheLine(ptHBLst[i].C2D(-radius), ptHBLst[i].C2D(-radius, -pierPara.pierRebar.pilecap_penetration_depth - (topH - pierPara.pierRebar.concrete_protect_layer)), liN7.Length - 40);
                        ptN7ALst.Add(ptN7D);
                    }
                    if (ptN7ALst.Count > 1)
                    {
                        spaceN7ALst.Add(ptN7ALst[ptN7ALst.Count - 1].X - ptN7ALst[ptN7ALst.Count - 2].X);
                    }
                }

            }
            if (pierPara.pierRebar.pilecap_penetration_depth == pierPara.pierRebar.beam_penetration_depth)
                RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptN7ALst[0].C3D(), ArrowDirection.West, new List<double>(), spaceN7ALst, "7", scale, true, 12, 0 * scale);
            else
                RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptN7ALst[0].C3D(), ArrowDirection.West, new List<double>(), spaceN7ALst, "7a", scale, true, 12, 0 * scale);


            PLPloter.AddLine(db,ptBC.C2D(0,-45), ptBC.C2D(endBCL,-45), ref ext, "H钢筋");
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBC.C2D(topThickness * 0.6, -45).C3D(), ArrowDirection.North, new List<double>(), new List<double>(), "8", scale, true, 5, 0 * scale);
            #endregion

            #region 3#，10a#

            l1 = new Line(ptICB3.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICB5.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
            lenLine = l1.Length;

            p1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine + lenN3T).C3D();
            p2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lOut.Length).C3D();
            PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            ptALst = new List<Point3d>();
            for (int i = 0; i < lenN3 / pierPara.pierRebar.pier_angle_reinforcement_space; i++)
            {
                double lenDiv = (lenLine - 2 * radius) * i / (lenN3 / pierPara.pierRebar.pier_angle_reinforcement_space);
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenDiv + radius).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptALst.Add(pp1);
            }
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);

            ptN8 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenLine * 0.2).C3D();
            RebarDimPloter.CreateHookLineMark(db, ref ext, ptN8, "3a", 3 * scale, scale, GeTools.RadianToDegree(ang));
            RebarDimPloter.CreateHookLineMark(db, ref ext, ptALst[ptALst.Count / 2], ptALst, "10a", 3 * scale, scale, 360 - GeTools.RadianToDegree(ang));


            l2 = new Line(ptICB4.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICB6.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
            lenLine2 = l2.Length;

            p1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenLine + lenN3T).C3D();
            p2 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), -lOut.Length).C3D();
            PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            ptALst = new List<Point3d>();
            for (int i = 0; i < lenN3 / pierPara.pierRebar.pier_angle_reinforcement_space; i++)
            {
                double lenDiv = (lenLine2 - 2 * radius) * i / (lenN3 / pierPara.pierRebar.pier_angle_reinforcement_space);
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenDiv + radius).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptALst.Add(pp1);
            }
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);
            #endregion
            #endregion

            #region 承台外轮廓绘制
            double pileCapW = pierPara.column.top_w * 1.6; // pierPara.pileCap.pile_cap_width;
            double pileCapH = pierPara.pileCap.pile_cap_height > pierPara.pierRebar.pilecap_penetration_depth + 3 * scale ? pierPara.pileCap.pile_cap_height : (pierPara.pierRebar.pilecap_penetration_depth + 3 * scale);
            ptLst = new List<Point2d>();
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5));
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5));
            //PLPloter.AddPolylineByPointList(ptLst, ref ext, "H细线", true);

            #region 钢筋绘制
            //total = 0;
            //for (int i = 0; i < spanPileCapLst.Count; i++)
            //{
            //    total += spanPileCapLst[spanPileCapLst.Count - 1 - i];

            //    //Point2d ptbt2 = ptBottomC.C2D(-pierPara.column.top_w * 0.5 + pierPara.pierRebar.pier_protect_layer, -total);
            //    if (i == spanPileCapLst.Count - 1)
            //    {
            //        len = 0;
            //        Point2d ptbt1 = ptBottomC.C2D(-pierPara.column.top_w * 0.5 + avg, -total);
            //        PLPloter.AddLine(db,ptCB1.C2D(avg), ptbt1, ref ext, "H钢筋");
            //        for (int m = 0; m < spancwLst.Count; m++)
            //        {
            //            len += spancwLst[m];
            //            if (m == spancsLst.Count - 1 || m == spancwLst.Count - spancsLst.Count - 1 || m == spancwLst.Count - 1)
            //                PLPloter.AddLine(db,ptCB1.C2D(avg + len), ptbt1.C2D(len), ref ext, "H钢筋");
            //        }

            //        DimPloter.DimRot(db, ptbt1.C3D(), ptbt1.C3D(0, spanPileCapLst[spanPileCapLst.Count - 1 - i]), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //        DimPloter.DimRot(db, ptBottomC.C3D(), ptbt1.C3D(0, spanPileCapLst[spanPileCapLst.Count - 1 - i]), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //    }
            //    else
            //    {
            //        //PLPloter.AddLine(db,ptBottomC.C2D(-pierPara.column.top_w * 0.5 + avg, -total), ptBottomC.C2D(pierPara.column.top_w * 0.5 - avg, -total), ref ext, "H钢筋");

            //        PLPloter.AddLine(db,ptBottomC.C2D(-pierPara.column.top_w * 0.5 + avg, -total), ptBottomC.C2D(-pierPara.column.top_w * 0.5 + avg + spaceLen, -total), ref ext, "H钢筋");
            //        PLPloter.AddLine(db,ptBottomC.C2D(pierPara.column.top_w * 0.5 - avg, -total), ptBottomC.C2D(pierPara.column.top_w * 0.5 - avg - spaceLen, -total), ref ext, "H钢筋");
            //    }
            //}
            len = 0;
            Point2d ptbt1 = ptBottomC.C2D(-pierPara.column.top_w * 0.5 + avg, -pierPara.pierRebar.pilecap_penetration_depth);
            PLPloter.AddLine(db,ptCB1.C2D(avg), ptbt1, ref ext, "H钢筋");
            for (int m = 0; m < spancwLst.Count; m++)
            {
                len += spancwLst[m];
                if (m == spancsLst.Count - 1 || m == spancwLst.Count - spancsLst.Count - 1 || m == spancwLst.Count - 1)
                    PLPloter.AddLine(db,ptCB1.C2D(avg + len), ptbt1.C2D(len), ref ext, "H钢筋");
            }
            #endregion
            if (pierPara.pierRebar.top_encryption_length > 0)
            {
                DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptDimT.C3D(), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebar.top_encryption_length / pierPara.pierRebar.top_encryption_spacing + "×" + pierPara.pierRebar.top_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptDimT.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "L-" + pierPara.pierRebar.top_encryption_length / pierPara.pierRebar.top_encryption_spacing + "×" + pierPara.pierRebar.top_encryption_spacing + "-" + pierPara.pierRebar.bottom_encryption_length / pierPara.pierRebar.bottom_encryption_spacing + "×" + pierPara.pierRebar.bottom_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, ptDimT.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "n1×" + pierPara.pierRebar.middle_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            }
            else
            {
                DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "n1×" + pierPara.pierRebar.middle_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            }
            //DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptDimT.C3D(), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebar.top_encryption_length / pierPara.pierRebar.top_encryption_spacing + "×" + pierPara.pierRebar.top_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            ////DimPloter.DimRot(db, ptDimT.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "L-" + pierPara.pierRebar.top_encryption_length / pierPara.pierRebar.top_encryption_spacing + "×" + pierPara.pierRebar.top_encryption_spacing + "-" + pierPara.pierRebar.bottom_encryption_length / pierPara.pierRebar.bottom_encryption_spacing + "×" + pierPara.pierRebar.bottom_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptDimT.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "n1×" + pierPara.pierRebar.middle_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptDimB.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebar.bottom_encryption_length / pierPara.pierRebar.bottom_encryption_spacing + "×" + pierPara.pierRebar.bottom_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            if (pierPara.pierRebar.pier_v_reinforcement_pilecap_depth > 0)
                DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);

            //DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBMid.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebar.beam_penetration_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebar.beam_penstration_layout, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBMid.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebar.beam_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, -pierPara.pierRebar.pilecap_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "H", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, -pierPara.pierRebar.pilecap_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            #endregion


            List<double> lList = new List<double>();

            for (int i = 0; i < 5; i++)
            {
                lList.Add(pierPara.pierRebar.middle_encryption_spacing);
            }
            for (int i = 0; i < 5; i++)
            {
                lList.Add(pierPara.pierRebar.bottom_encryption_spacing);
            }
            RebarPLPloter.CreateLineArrowMultDBNew(db, ref ext, ptDimB.C3D(pierPara.column.top_w - bottomThickness * 0.6, 5 * pierPara.pierRebar.middle_encryption_spacing), ArrowDirection.South, lList, new List<double>(), "5", "5a", scale, true, 1, 5 * scale);
        }


        /// <summary>
        /// 侧面C
        /// </summary>
        /// <param name="db"></param>
        /// <param name="ext"></param>
        /// <param name="insertPoint"></param>
        /// <param name="pierPara"></param>
        /// <param name="_scale"></param>
        public void PlotPierSideD(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "D-D", "", scale);
            Point2d pt = insertPoint.C2D(0, -3 * scale);
            //Point3d ptDim = pt.C3D(pierPara.pileCap.pile_cap_length * 0.5 + 10 * scale);
            //double halfPile = 15 * scale;//桩长示意长度

            double BeamW = pierPara.column.top_l + 20;
            Point3d ptDim = pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale);
            //Point3d ptDimL = pt.C3D(-pierPara.pileCap.pile_cap_length * 0.5 - 15 * scale);
            Point3d ptDimL = pt.C3D(-pierPara.column.top_l * 1.6 * 0.5 - 15 * scale);
            Point3d ptDimT = ptDim;
            Point3d ptDimB = ptDim;
            #region 盖梁外轮廓绘制
            double BeamH = pierPara.pierRebar.beam_penetration_depth + 4 * scale;
            //double BeamW = pierPara.column.top_l + 20;
            List<Point2d> ptLst = new List<Point2d>();
            Point2d pt1 = pt.C2D(-BeamW * 0.5);
            Point2d pt6 = pt.C2D(BeamW * 0.5);
            Point2d pt2 = pt1.C2D(0, -BeamH);
            Point2d pt3 = pt.C2D(-pierPara.column.top_l * 0.5, -BeamH);
            Point2d pt4 = pt.C2D(pierPara.column.top_l * 0.5, -BeamH);
            Point2d pt5 = pt6.C2D(0, -BeamH);

            ptLst.Add(pt1);
            ptLst.Add(pt2);
            ptLst.Add(pt3);
            //ptLst.Add(pt4);
            //ptLst.Add(pt5);
            //ptLst.Add(pt6);
            Point2d ptBMid = pt.C2D(0, -BeamH);

            //PLPloter.AddPolylineByPointList(ptLst, ref ext, "H细线", false);
            ptLst = new List<Point2d>();
            ptLst.Add(pt4);
            ptLst.Add(pt5);
            ptLst.Add(pt6);
            //PLPloter.AddPolylineByPointList(ptLst, ref ext, "H细线", false);
            PLPloter.AddLine(db,pt3, pt4, ref ext, "H虚线");

            //PLPloter.CreateBreakLineP(db, ref ext, pt1, pt6, scale, "H细线");


            #region 钢筋绘制

            double total = 0;
            double lenL = Math.Round(spanclLst.Sum(), 1);
            double avg = sideOut;

            #endregion

            #endregion



            #region 墩身外轮廓绘制
            double cap = 2 * scale;
            //int BulkheadCount = 2;
            double columnH = (pierPara.h3 - pierPara.h2) * 100;
            //double angC = (pierPara.column.BottowW - pierPara.column.top_w)/(pierPara.h3- pierPara.h2);
            double topH = pierPara.column.top_solid_h;
            double botH = pierPara.column.bottom_solid_h;
            string[] sizeT = pierPara.column.section_l_ang.Split('*');
            string[] sizeM = pierPara.column.section_mid_l_ang.Split('*');
            string[] sizeBulk = pierPara.column.bulkhead_size_l.Split('*');
            double tH = double.Parse(sizeT[1]);
            double tw = double.Parse(sizeT[0]);
            double mH = double.Parse(sizeM[1]);
            double mw = double.Parse(sizeM[0]);
            double bH = double.Parse(sizeBulk[1]);
            double bw = double.Parse(sizeBulk[0]);
            //double bwL = double.Parse(sizeBulkL[1]);

            #region 外轮廓上部

            Point2d ptCF1 = ptBMid.C2D(-(pierPara.column.top_l * 0.5 + FH * pierPara.column.slope_l), -FH);
            Point2d ptCF2 = ptBMid.C2D((pierPara.column.top_l * 0.5 + FH * pierPara.column.slope_l), -FH);
            PLPloter.AddLine(db,pt3, ptCF1, ref ext, "H细线");
            PLPloter.AddLine(db,pt4, ptCF2, ref ext, "H细线");
           
            if (BulkheadCount == 0)
                PLPloter.CreateBreakLineP(db, ref ext, ptCF1.C2D(-5 * scale), ptCF2.C2D(5 * scale), scale, "H细线");
            else
                PLPloter.CreateBreakLineP(db, ref ext, ptCF1.C2D(-5 * scale - 1 * scale), ptCF2.C2D(5 * scale + 1 * scale), scale, "H细线");

            Point2d ptDimP = ptBMid.C2D((pierPara.column.top_l * 0.5 + FH*0.5 * pierPara.column.slope_l), -FH * 0.5);
            DimPloter.DimRadius(db,ptDimP.C3D(0, 0), ptDimP.C3D(0.01, 0), 2 * scale, ref ext, scale, "净" + pierPara.pierRebar.concrete_protect_layer);
            #region 钢筋
            double len = 0;

            Point2d ptSt = pt3.C2D(avg + pierPara.pierRebar.beam_penetration_depth * pierPara.column.slope_l, pierPara.pierRebar.beam_penetration_depth);
            double stL = lenL - pierPara.pierRebar.beam_penetration_depth * pierPara.column.slope_l * 2;
            List<Point2d> ptTLst = new List<Point2d>();
            RebarArrangement.ArrangePoint(ptSt, spancslLst, spancmlLst, lenL, stL, out ptTLst);
            Point2d ptEnd = ptCF1.C2D(avg);
            double endL = lenL + FH * pierPara.column.slope_l * 2;
            List<Point2d> ptBLst = new List<Point2d>();
            RebarArrangement.ArrangePoint(ptEnd, spancslLst, spancmlLst, lenL, endL, out ptBLst);
            PLPloter.AddLine(db,ptSt, ptEnd, ref ext, "H钢筋");
            for (int m = 0; m < ptTLst.Count; m++)
            {
                if (m == spancslLst.Count || m == spanclLst.Count - spancslLst.Count || m == spanclLst.Count)
                    PLPloter.AddLine(db,ptTLst[m], ptBLst[m], ref ext, "H钢筋");
            }
            int numR = (int)((FH-10- topH) / pierPara.pierRebar.top_encryption_spacing);
            int numRT = (int)((tH) / pierPara.pierRebar.top_encryption_spacing);
            //Point2d ptICF1 = ptBMid.C2D(-pierPara.column.top_w * 0.5 + topThickness, -(topH + tH));
            //Point2d ptICF2 = ptBMid.C2D(pierPara.column.top_w * 0.5 - topThickness, -(topH + tH));
            Point2d ptICF1 = ptBMid.C2D(-(pierPara.column.top_l * 0.5 + (topH + tH) * pierPara.column.slope_l) + topThickness, -(topH + tH));
            Point2d ptICF2 = ptBMid.C2D((pierPara.column.top_l * 0.5 + (topH + tH) * pierPara.column.slope_l) - topThickness, -(topH + tH));
            double ang = Math.Atan(tw / tH);
            Line lineA1 = new Line(ptICF1.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICF1.C2D(tw, tH).C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
            Line lineA2 = new Line(ptICF2.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICF2.C2D(-tw, tH).C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
            double lenH = 10;
            if (BulkheadCount > 0)
            {
                for (int i = 1; i <= numR; i++)
                {
                    lenH += pierPara.pierRebar.top_encryption_spacing;
                    Point2d ptV1 = ptCF1.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                    double vL = lenL + FH * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2;
                    List<Point2d> ptVLst = new List<Point2d>();
                    RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);
                    if (i < numR - numRT)
                    {

                        if (isModify)
                        {
                            if (i % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                        }
                        //PLPloter.AddLine(db,ptCF1.C2D(avg + (lenH) * pierPara.column.slope_l, lenH), ptCF2.C2D(-avg - (lenH) * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                    }
                    else
                    {
                        //倒角位置
                        Line lineAT1 = new Line(ptVLst[0].C3D(), ptVLst[spancslLst.Count].C3D());
                        Line lineAT2 = new Line(ptVLst[spanclLst.Count - spancslLst.Count].C3D(), ptVLst[spanclLst.Count].C3D());
                        Point3d ptO1 = MathExtensions.GetIntersection(lineAT1, lineA1);
                        Point3d ptO2 = MathExtensions.GetIntersection(lineAT2, lineA2);
                        if (isModify)
                        {
                            if (i % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptVLst[0].C2D(), ptO1.C2D(), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptVLst[spanclLst.Count].C2D(), ptO2.C2D(), ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptVLst[0].C2D(), ptO1.C2D(), ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptVLst[spanclLst.Count].C2D(), ptO2.C2D(), ref ext, "H钢筋");
                        }
                    }
                }
            }
            else
            {
                numR = (int)((FH - 10 - 10 * pierPara.pierRebar.middle_encryption_spacing- topH) / pierPara.pierRebar.top_encryption_spacing);
                for (int i = 1; i <= 10; i++)
                {
                    lenH += pierPara.pierRebar.middle_encryption_spacing;
                    Point2d ptV1 = ptCF1.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                    double vL = lenL + FH * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2;
                    List<Point2d> ptVLst = new List<Point2d>();
                    RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);
                    if (isModify)
                    {
                        if (i % 3 == 0)
                        {
                            PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                        }
                    }
                    else
                    {
                        PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                        PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                    }
                    if (i == 10)
                        ptDimT = ptCF1.C3D(avg, lenH);
                }
                for (int i = 1; i <= numR; i++)
                {
                    lenH += pierPara.pierRebar.top_encryption_spacing;
                    Point2d ptV1 = ptCF1.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                    double vL = lenL + FH * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2;
                    List<Point2d> ptVLst = new List<Point2d>();
                    RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);
                    if (i < numR - numRT)
                    {
                        if (isModify)
                        {
                            if (i % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                        }
                    }
                    else
                    {
                        //倒角位置
                        Line lineAT1 = new Line(ptVLst[0].C3D(), ptVLst[spancslLst.Count].C3D());
                        Line lineAT2 = new Line(ptVLst[spanclLst.Count - spancslLst.Count].C3D(), ptVLst[spanclLst.Count].C3D());
                        Point3d ptO1 = MathExtensions.GetIntersection(lineAT1, lineA1);
                        Point3d ptO2 = MathExtensions.GetIntersection(lineAT2, lineA2);
                        if (isModify)
                        {
                            if (i % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptVLst[0].C2D(), ptO1.C2D(), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptVLst[spanclLst.Count].C2D(), ptO2.C2D(), ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptVLst[0].C2D(), ptO1.C2D(), ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptVLst[spanclLst.Count].C2D(), ptO2.C2D(), ref ext, "H钢筋");
                        }
                    }
                }
            }
            #endregion
            #endregion

            #region 内轮廓上部

            Point2d ptIC = ptBMid.C2D(0, -topH);
            //Point2d ptICF1 = ptBMid.C2D(-(pierPara.column.top_l * 0.5 + (topH + tH) * pierPara.column.slope_l) + topThickness, -(topH + tH));
            //Point2d ptICF2 = ptBMid.C2D((pierPara.column.top_l * 0.5 + (topH + tH) * pierPara.column.slope_l) - topThickness, -(topH + tH));
            ptLst = new List<Point2d>();
            //ptLst.Add(ptCF1.C2D(topThickness));
            ptLst.Add(ptBLst[spancslLst.Count].C2D(pierPara.pierRebar.concrete_protect_layer));
            ptLst.Add(ptICF1.C2D());
            ptLst.Add(ptICF1.C2D(tw, tH));
            ptLst.Add(ptICF2.C2D(-tw, tH));
            ptLst.Add(ptICF2.C2D());
            ptLst.Add(ptBLst[spanclLst.Count - spancslLst.Count].C2D(-pierPara.pierRebar.concrete_protect_layer));
            //ptLst.Add(ptCF2.C2D(-topThickness));
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);

            List<Point2d> ptTCLst = new List<Point2d>();
            Point2d ptTC = ptIC.C2D(-pierPara.column.top_l * 0.5 - (topH - pierPara.pierRebar.concrete_protect_layer) * pierPara.column.slope_l + avg, pierPara.pierRebar.concrete_protect_layer);
            double endTCL = lenL + (topH - pierPara.pierRebar.concrete_protect_layer) * pierPara.column.slope_l * 2;
            RebarArrangement.ArrangePoint(ptTC, spancslLst, spancmlLst, lenL, endTCL, out ptTCLst);
            for (int m = 0; m < ptTCLst.Count; m++)
            {
                if (m == spancslLst.Count)
                    PLPloter.AddLine(db,ptTCLst[m], ptTCLst[spanclLst.Count - spancslLst.Count], ref ext, "H钢筋");
            }
            List<Point3d> ptHLst = new List<Point3d>();
            List<double> ptHSLst = new List<double>();
            string spH = "";
            double le = ptTCLst[spanclLst.Count - spancslLst.Count].X - ptTCLst[spancslLst.Count].X - 2 * radius-2*tw - 2 * pierPara.pierRebar.pier_protect_layer; ;
            SteelBarPileCap.CreateAvgCircleHatchList(db, ref ext, ptTCLst[spancslLst.Count].C2D(radius+ tw+ pierPara.pierRebar.pier_protect_layer),
               radius, le, le, pierPara.pierRebar.pier_solid_reinforcement_space, 0, radius, out ptHLst, out ptHSLst, out spH, eDirection.E_TOP, true);
            PLPloter.AddLine(db,ptTCLst[0], ptTCLst[ptTCLst.Count - 1], ref ext, "H钢筋");

            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_BOTTOM, ptHLst, "6a", ptHLst.Count / 8, ptHLst.Count / 8, scale, false, 6 * scale);

           
            for (int m = 0; m < ptTCLst.Count; m++)
            {
                if (m == spancslLst.Count)
                    PLPloter.AddLine(db,ptTCLst[m], ptTCLst[spanclLst.Count - spancslLst.Count], ref ext, "H钢筋");
            }

            List<Point2d> ptBeamCLst = new List<Point2d>();
            List<Point2d> ptN7Lst = new List<Point2d>();
            List<double> spaceN7Lst = new List<double>();
            Point2d ptBeamC = ptBMid.C2D(-pierPara.column.top_l * 0.5 + (pierPara.pierRebar.beam_penetration_depth) * pierPara.column.slope_l + avg, pierPara.pierRebar.beam_penetration_depth);
            double endBeamCL = lenL - (pierPara.pierRebar.beam_penetration_depth) * pierPara.column.slope_l * 2;
            RebarArrangement.ArrangePoint(ptBeamC, spancslLst, spancmlLst, lenL, endBeamCL, out ptBeamCLst);
            for (int i = 0; i < ptHLst.Count; i++)
            {

                if ((i) % 3 == 0||i == ptHLst.Count-1)
                {
                    if (i == ptHLst.Count - 1)
                    {
                        PLPloter.AddLine(db,ptHLst[i].C2D(radius, -radius), ptHLst[i].C2D(radius, pierPara.pierRebar.beam_penetration_depth + topH - pierPara.pierRebar.concrete_protect_layer - radius), ref ext, "H钢筋");
                        Line liN7 = new Line(ptHLst[i].C3D(radius, -radius), ptHLst[i].C3D(radius, pierPara.pierRebar.beam_penetration_depth + topH - pierPara.pierRebar.concrete_protect_layer - radius));
                        Point2d ptN7D = MathExtensions.GetPointOnTheLine(ptHLst[i].C2D(radius, -radius), ptHLst[i].C2D(radius, pierPara.pierRebar.beam_penetration_depth + topH - pierPara.pierRebar.concrete_protect_layer - radius), liN7.Length - 40);
                        ptN7Lst.Add(ptN7D);
                    }
                    else
                    {
                        PLPloter.AddLine(db,ptHLst[i].C2D(-radius, -radius), ptHLst[i].C2D(-radius, pierPara.pierRebar.beam_penetration_depth + topH - pierPara.pierRebar.concrete_protect_layer - radius), ref ext, "H钢筋");
                        Line liN7 = new Line(ptHLst[i].C3D(-radius, -radius), ptHLst[i].C3D(-radius, pierPara.pierRebar.beam_penetration_depth + topH - pierPara.pierRebar.concrete_protect_layer - radius));
                        Point2d ptN7D = MathExtensions.GetPointOnTheLine(ptHLst[i].C2D(-radius, -radius), ptHLst[i].C2D(-radius, pierPara.pierRebar.beam_penetration_depth + topH - pierPara.pierRebar.concrete_protect_layer - radius), liN7.Length - 40);
                        ptN7Lst.Add(ptN7D);
                    }
                    if (ptN7Lst.Count > 1)
                    {
                        spaceN7Lst.Add(ptN7Lst[ptN7Lst.Count - 1].X - ptN7Lst[ptN7Lst.Count - 2].X);
                    }
                }

            }
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptN7Lst[0].C3D(), ArrowDirection.West, new List<double>(), spaceN7Lst, "7", scale, true, 8, 0 * scale);

            N7N += ptN7Lst.Count * 4;
            PLPloter.AddLine(db,ptTC.C2D(0, 45), ptTC.C2D(endTCL, 45), ref ext, "H钢筋");
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptTC.C2D(topThickness*0.6, 45).C3D(), ArrowDirection.South, new List<double>(), new List<double>(), "8a", scale, true, 5, 0 * scale);
            #region 3#，10#
            //double ang = Math.Atan(tw / tH);
            Line l1 = new Line(ptICF1.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICF1.C2D(tw, tH).C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
            double lenLine = l1.Length;

            //Line lOut1 = new Line(pt3.C3D(avg), ptCF1.C3D(avg));
            //Point3d ptOut = MathExtensions.GetIntersection(l1, lOut1);
            //Line lOut = new Line(ptOut, l1.StartPoint);
            Point3d p1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine + lenN3T).C3D();
            Point3d p2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenN3).C3D();
            PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            List<Point3d> ptALst = new List<Point3d>();
            for (int i = 0; i < (lenN3 / pierPara.pierRebar.pier_angle_reinforcement_space); i++)
            {
                double lenDiv = (lenLine - 2 * radius) * i / (lenN3 / pierPara.pierRebar.pier_angle_reinforcement_space);
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenDiv + radius).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptALst.Add(pp1);
            }
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);
            Point3d ptN8 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenLine * 0.2).C3D();
            RebarDimPloter.CreateHookLineMark(db, ref ext, ptN8, "3a", 3 * scale, scale, 360 - GeTools.RadianToDegree(ang));
            RebarDimPloter.CreateHookLineMark(db, ref ext, ptALst[ptALst.Count / 2], ptALst, "10", 3 * scale, scale, 360 - GeTools.RadianToDegree(ang));

            Line l2 = new Line(ptICF2.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICF2.C2D(-tw, tH).C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
            double lenLine2 = l2.Length;

            p1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenLine + lenN3T).C3D();
            p2 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), -lenN3).C3D();
            PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            ptALst = new List<Point3d>();
            for (int i = 0; i < (lenN3 / pierPara.pierRebar.pier_angle_reinforcement_space); i++)
            {
                double lenDiv = (lenLine2 - 2 * radius) * i / (lenN3 / pierPara.pierRebar.pier_angle_reinforcement_space);
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenDiv + radius).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptALst.Add(pp1);
            }
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);
            #endregion

            #endregion

            #region 中部
            double HB = (MH - mH * 2 - bH) * 0.5;
            //ptCF1 = ptCF1.C2D(-2*scale);
            //ptCF2= ptCF2.C2D(2 * scale);
            Point2d ptCM1 = ptCF1.C2D(0, -cap);
            Point2d ptCM2 = ptCF2.C2D(0, -cap);
            Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_l, -cap - MH);
            Point2d ptCM2E = ptCF2.C2D((MH) * pierPara.column.slope_l, -cap - MH);
            Point2d ptCM1ELast = ptCF1.C2D(-(MH) * pierPara.column.slope_l, -cap - MH);
            Point2d ptCM2ELast = ptCF2.C2D((MH) * pierPara.column.slope_l, -cap - MH);


            Point2d ptICM = ptBMid.C2D(0, -FH - cap);
            Point2d ptICM1 = ptCF1.C2D(0, -cap);
            Point2d ptICM2 = ptCF2.C2D(0, -cap);
            //if (pierPara.column.slope_l > 0)
            //{
            //    TextPloter.AddDBText(db,ptCM2.C3D(6 * scale, -10 * scale), ref ext, "1:" + 1 / pierPara.column.slope_l, scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90));
            //}
            if (BulkheadCount == 0)
            {
                ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_w, -MH);
                ptCM2E = ptCF2.C2D((MH) * pierPara.column.slope_w, -MH);
            }
            for (int i = 0; i < BulkheadCount; i++)
            {
                #region 外轮廓
                ptCF1 = ptCF1.C2D(-1 * scale);
                ptCF2 = ptCF2.C2D(1 * scale);
                ptCM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_l, -cap * (i + 1) - MH * i);
                ptCM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_l, -cap * (i + 1) - MH * i);
                ptCM1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_l, -cap * (i + 1) - MH * (i + 1));
                ptCM2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_l, -cap * (i + 1) - MH * (i + 1));
                if (i == 0)
                    PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(-5 * scale - 1 * scale * i), ptCM2.C2D(5 * scale + 1 * scale * i), scale, "H细线");
                else
                    PLPloter.CreateBreakLineP(db, ref ext, ptCM1ELast.C2D(-5 * scale, -cap), ptCM2ELast.C2D(5 * scale, -cap), scale, "H细线");
                PLPloter.AddLine(db,ptCM1, ptCM1E, ref ext, "H细线");
                PLPloter.AddLine(db,ptCM2, ptCM2E, ref ext, "H细线");
                if (i < BulkheadCount - 1)
                    PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale), ptCM2E.C2D(5 * scale), scale, "H细线");

                ptCM1ELast = ptCM1E;
                ptCM2ELast = ptCM2E;
                #endregion

                #region 钢筋

                ptSt = ptCM1.C2D(avg);
                stL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * i * pierPara.column.slope_l * 2 + 2 * (i + 1) * scale;
                ptTLst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptSt, spancslLst, spancmlLst, lenL, stL, out ptTLst);
                ptEnd = ptCM1E.C2D(avg);
                endL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2 + 2 * (i + 1) * scale;
                ptBLst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptEnd, spancslLst, spancmlLst, lenL, endL, out ptBLst);

                Point2d ptStE = ptCM1.C2D(avg - HB * pierPara.column.slope_l, -HB);
                double stLE = lenL + FH * pierPara.column.slope_l * 2 + ((MH) * i + HB) * pierPara.column.slope_l * 2 + 2 * (i + 1) * scale;
                List<Point2d> ptTELst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptStE, spancslLst, spancmlLst, lenL, stLE, out ptTELst);
                Point2d ptEndS = ptCM1E.C2D(avg + HB * pierPara.column.slope_l, HB);
                double endLS = lenL + FH * pierPara.column.slope_l * 2 + ((MH) * (i + 1) - HB) * pierPara.column.slope_l * 2 + 2 * (i + 1) * scale;
                List<Point2d> ptBSLst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptEndS, spancslLst, spancmlLst, lenL, endLS, out ptBSLst);

                PLPloter.AddLine(db,ptSt, ptEnd, ref ext, "H钢筋");
                for (int m = 0; m < ptTLst.Count; m++)
                {
                    if (m == spancslLst.Count || m == spanclLst.Count - spancslLst.Count || m == spanclLst.Count)
                        PLPloter.AddLine(db,ptTLst[m], ptBLst[m], ref ext, "H钢筋");
                }

                if (BulkheadCount > 1)
                {
                    if (i == 0)
                    {
                        numR = (int)((MH - pierPara.pierRebar.top_encryption_spacing * 10) / pierPara.pierRebar.middle_encryption_spacing);
                        lenH = 0;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebar.top_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1.C2D(avg - lenH * pierPara.column.slope_l, -lenH), ptCM2.C2D(-avg + lenH * pierPara.column.slope_l, -lenH), ref ext, "H钢筋");
                            Point2d ptV1 = ptCM1.C2D(avg - lenH * pierPara.column.slope_l, -lenH);
                            double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * i * pierPara.column.slope_l * 2 + lenH * pierPara.column.slope_l * 2 + 2 * (i + 1) * scale;
                            List<Point2d> ptVLst = new List<Point2d>();
                            RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                {
                                    PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                                    PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                                }
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                            }
                            if (m == 10)
                                ptDimT = ptCM1.C3D(avg - lenH * pierPara.column.slope_l, -lenH);
                        }
                        for (int m = 1; m <= numR; m++)
                        {
                            lenH += pierPara.pierRebar.middle_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1.C2D(avg - lenH * pierPara.column.slope_l, -lenH), ptCM2.C2D(-avg + lenH * pierPara.column.slope_l, -lenH), ref ext, "H钢筋");
                            Point2d ptV1 = ptCM1.C2D(avg - lenH * pierPara.column.slope_l, -lenH);
                            double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * i * pierPara.column.slope_l * 2 + lenH * pierPara.column.slope_l * 2 + 2 * (i + 1) * scale;
                            List<Point2d> ptVLst = new List<Point2d>();
                            RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                {
                                    PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                                    PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                                }
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                            }
                        }
                    }
                    else if (i == BulkheadCount - 1)
                    {
                        numR = (int)((MH - pierPara.pierRebar.bottom_encryption_spacing * 10) / pierPara.pierRebar.middle_encryption_spacing);
                        lenH = 0;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebar.bottom_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                            Point2d ptV1 = ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                            double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2 + 2 * (i + 1) * scale;
                            List<Point2d> ptVLst = new List<Point2d>();
                            RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                {
                                    PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                                    PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                                }
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                            }
                            if (m == 10)
                                ptDimB = ptCM1E.C3D(avg + lenH * pierPara.column.slope_l, lenH);
                        }
                        for (int m = 1; m <= numR; m++)
                        {
                            lenH += pierPara.pierRebar.middle_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                            Point2d ptV1 = ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                            double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2 + 2 * (i + 1) * scale;
                            List<Point2d> ptVLst = new List<Point2d>();
                            RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                {
                                    PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                                    PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                                }
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                            }

                        }
                    }
                    else
                    {
                        //numR = (int)((MH - pierPara.pierRebar.bottom_encryption_spacing * 10 - pierPara.pierRebar.top_encryption_spacing * 10-10) / pierPara.pierRebar.middle_encryption_spacing);
                        numR = (int)((MH -  10) / pierPara.pierRebar.middle_encryption_spacing);
                        lenH = 10;
                        //for (int m = 1; m <= 10; m++)
                        //{
                        //    lenH += pierPara.pierRebar.bottom_encryption_spacing;
                        //    //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        //    Point2d ptV1 = ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                        //    double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2 + 2 * (i + 1) * scale;
                        //    List<Point2d> ptVLst = new List<Point2d>();
                        //    RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);

                        //    PLPloter.AddLine(db,ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                        //    PLPloter.AddLine(db,ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");

                        //    if (m == 10)
                        //        ptDimB = ptCM1E.C3D(avg + lenH * pierPara.column.slope_l, lenH);
                        //}
                        for (int m = 1; m <= numR; m++)
                        {
                            lenH += pierPara.pierRebar.middle_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            Point2d ptV1 = ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                            double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2 + 2 * (i + 1) * scale;
                            List<Point2d> ptVLst = new List<Point2d>();
                            RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);
                            if (isModify)
                            {
                                if (m % 3 == 0)
                                {
                                    PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                                    PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                                }
                            }
                            else
                            {
                                PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                            }
                        }
                        //for (int m = 1; m <= 10; m++)
                        //{
                        //    lenH += pierPara.pierRebar.top_encryption_spacing;
                        //    //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        //    Point2d ptV1 = ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                        //    double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2 + 2 * (i + 1) * scale;
                        //    List<Point2d> ptVLst = new List<Point2d>();
                        //    RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);

                        //    PLPloter.AddLine(db,ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                        //    PLPloter.AddLine(db,ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");

                        //    if (m == 1)
                        //        ptDimT = ptCM1E.C3D(avg + lenH * pierPara.column.slope_l, lenH);
                        //}
                    }
                }
                else
                {
                    numR = (int)((MH - pierPara.pierRebar.bottom_encryption_spacing * 10 - pierPara.pierRebar.top_encryption_spacing * 10) / pierPara.pierRebar.middle_encryption_spacing);
                    lenH = 0;
                    for (int m = 1; m <= 10; m++)
                    {
                        lenH += pierPara.pierRebar.bottom_encryption_spacing;
                        //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        Point2d ptV1 = ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                        double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2 + 2 * (i + 1) * scale;
                        List<Point2d> ptVLst = new List<Point2d>();
                        RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);
                        if (isModify)
                        {
                            if (m % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                        }
                        if (m == 10)
                            ptDimB = ptCM1E.C3D(avg + lenH * pierPara.column.slope_l, lenH);
                    }
                    for (int m = 1; m <= numR; m++)
                    {
                        lenH += pierPara.pierRebar.middle_encryption_spacing;
                        //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                        Point2d ptV1 = ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                        double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2 + 2 * (i + 1) * scale;
                        List<Point2d> ptVLst = new List<Point2d>();
                        RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);
                        if (isModify)
                        {
                            if (m % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                        }
                    }
                    for (int m = 1; m <= 10; m++)
                    {
                        lenH += pierPara.pierRebar.top_encryption_spacing;
                        //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                        Point2d ptV1 = ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                        double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2 + 2 * (i + 1) * scale;
                        List<Point2d> ptVLst = new List<Point2d>();
                        RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);
                        if (isModify)
                        {
                            if (m % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                        }

                        if (m == 1)
                            ptDimT = ptCM1E.C3D(avg + lenH * pierPara.column.slope_l, lenH);
                    }
                }
                #endregion


                #region 内轮廓
                //ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i);              
                ptLst = new List<Point2d>();
                //ptICM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i);
                //ptICM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i);
                //Point2d ptICM3 = ptCF1.C2D(-(MH * i + HB) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i - HB);
                //Point2d ptICM4 = ptCF2.C2D((MH * i + HB) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i - HB);
                ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i - HB - mH);
                ptICM1 = ptTLst[spancslLst.Count].C2D(pierPara.pierRebar.concrete_protect_layer);
                ptICM2 = ptTLst[spanclLst.Count - spancslLst.Count].C2D(-pierPara.pierRebar.concrete_protect_layer);
                Point2d ptICM3 = ptTELst[spancslLst.Count].C2D(pierPara.pierRebar.concrete_protect_layer);
                Point2d ptICM4 = ptTELst[spanclLst.Count - spancslLst.Count].C2D(-pierPara.pierRebar.concrete_protect_layer);
                Point2d ptICM5 = ptICM3.C2D(mw, -mH);
                Point2d ptICM6 = ptICM4.C2D(-mw, -mH);
                //ptLst.Add(ptICM1);
                //ptLst.Add(ptICM3);
                //ptLst.Add(ptICM5);
                //ptLst.Add(ptICM6);
                //ptLst.Add(ptICM4);
                //ptLst.Add(ptICM2);
                //PLPloter.AddPolylineByPointList(ptLst, ref ext, "H细线", false);
                ptLst.Add(ptICM1);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM.C2D(-bw * 0.5));
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);

                ptLst = new List<Point2d>();
                ptLst.Add(ptICM.C2D(bw * 0.5));
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptICM2);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);
                //PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(bw * 0.5), ref ext, "H虚线");
                #region 隔板
                //ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i - HB - mH);
                PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(-bw * 0.5, -bH), ref ext, "H细线");
                PLPloter.AddLine(db,ptICM.C2D(bw * 0.5), ptICM.C2D(bw * 0.5, -bH), ref ext, "H细线");
                #endregion

                ptLst = new List<Point2d>();
                //Point2d ptCMI1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * (i + 1));
                //Point2d ptCMI2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * (i + 1));             
                //ptICM3 = ptCF1.C2D(-(HB + mH * 2 + bH) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                //ptICM4 = ptCF2.C2D((HB + mH * 2 + bH) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                Point2d ptCMI1E = ptBLst[spancslLst.Count].C2D(pierPara.pierRebar.concrete_protect_layer);
                Point2d ptCMI2E = ptBLst[spanclLst.Count - spancslLst.Count].C2D(-pierPara.pierRebar.concrete_protect_layer);
                ptICM3 = ptBSLst[spancslLst.Count].C2D(pierPara.pierRebar.concrete_protect_layer);
                ptICM4 = ptBSLst[spanclLst.Count - spancslLst.Count].C2D(-pierPara.pierRebar.concrete_protect_layer);
                ptICM5 = ptICM3.C2D(mw, mH);
                ptICM6 = ptICM4.C2D(-mw, mH);
                //ptLst.Add(ptCMI1E);
                //ptLst.Add(ptICM3);
                //ptLst.Add(ptICM5);
                //ptLst.Add(ptICM6);
                //ptLst.Add(ptICM4);
                //ptLst.Add(ptCMI2E);
                //PLPloter.AddPolylineByPointList(ptLst, ref ext, "H细线", false);
                ptLst.Add(ptCMI1E);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM.C2D(-bw * 0.5, -bH));
                //ptLst.Add(ptICM6);
                //ptLst.Add(ptICM4);
                //ptLst.Add(ptCMI2E);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);

                ptLst = new List<Point2d>();
                ptLst.Add(ptICM.C2D(bw * 0.5, -bH));
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptCMI2E);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);

                //PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5, -bH), ptICM.C2D(bw * 0.5, -bH), ref ext, "H虚线");
                #endregion 
            }


            #endregion



            #region 外轮廓下部

            Point2d ptBottomC = new Point2d(ptBMid.X, ptCM2E.Y - cap - BH);
            double BottomW = pierPara.column.top_l + pierPara.pier_height * 100 * pierPara.column.slope_l*2;

            Point2d ptCB1E = ptBottomC.C2D(-BottomW * 0.5);
            Point2d ptCB2E = ptBottomC.C2D(BottomW * 0.5);
            Point2d ptCB1 = ptCB1E.C2D(BH * pierPara.column.slope_l, BH);
            Point2d ptCB2 = ptCB2E.C2D(-BH * pierPara.column.slope_l, BH);
            PLPloter.CreateBreakLineP(db, ref ext, ptCB1.C2D(-5 * scale), ptCB2.C2D(5 * scale), scale, "H细线");
            //PLPloter.CreateBreakLineP(db, ref ext, ptCB1.C2D(-5 * scale), ptCB2.C2D(5 * scale), scale, "H细线");
            PLPloter.CreateBreakLineP(db, ref ext, ptCB1.C2D(-5 * scale, cap), ptCB2.C2D(5 * scale, cap), scale, "H细线");
            PLPloter.AddLine(db,ptCB1, ptCB1E, ref ext, "H细线");
            PLPloter.AddLine(db,ptCB2, ptCB2E, ref ext, "H细线");
            PLPloter.AddLine(db,ptCB1E, ptCB2E, ref ext, "H细线");

            numR = (int)((BH - pierPara.pierRebar.pier_v_reinforcement_pilecap_depth - botH) / pierPara.pierRebar.bottom_encryption_spacing);
            ptSt = ptBottomC.C2D(-BottomW * 0.5 + avg + BH * pierPara.column.slope_l, BH);
            stL = BottomW - 2 * avg - BH * pierPara.column.slope_l * 2;
            ptTLst = new List<Point2d>();
            RebarArrangement.ArrangePoint(ptSt, spancslLst, spancmlLst, lenL, stL, out ptTLst, pierPara.pierRebar.main_l_change_num);
            ptEnd = ptBottomC.C2D(-BottomW * 0.5 + avg + (botH + tH) * pierPara.column.slope_l, botH + tH);
            endL = BottomW - 2 * avg - (botH + tH) * pierPara.column.slope_l * 2;
            ptBLst = new List<Point2d>();
            RebarArrangement.ArrangePoint(ptEnd, spancslLst, spancmlLst, lenL, endL, out ptBLst, pierPara.pierRebar.main_l_change_num);
            double BIH = botH + tH;
            Point2d ptICB1 = ptTLst[spancslLst.Count].C2D(pierPara.pierRebar.concrete_protect_layer);
            Point2d ptICB2 = ptTLst[ptTLst.Count - 1 - spancslLst.Count].C2D(-pierPara.pierRebar.concrete_protect_layer);
            Point2d ptICB3 = ptBLst[spancslLst.Count].C2D(pierPara.pierRebar.concrete_protect_layer);
            Point2d ptICB4 = ptBLst[ptBLst.Count-1 - spancslLst.Count].C2D(-pierPara.pierRebar.concrete_protect_layer);
            //Point2d ptICB1 = ptCB1.C2D(bottomThickness);
            //Point2d ptICB2 = ptCB2.C2D(-bottomThickness);
            //Point2d ptICB3 = ptBottomC.C2D(-BottomW * 0.5 + bottomThickness + (botH + tH) * pierPara.column.slope_l, botH + tH);
            //Point2d ptICB4 = ptBottomC.C2D(BottomW * 0.5 - bottomThickness - (botH + tH) * pierPara.column.slope_l, botH + tH);
            Point2d ptICB5 = ptICB3.C2D(tw, -tH);
            Point2d ptICB6 = ptICB4.C2D(-tw, -tH);

            int numRB = (int)((tH) / pierPara.pierRebar.bottom_encryption_spacing);
            Line lineAB1 = new Line(ptICB3.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICB5.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
            Line lineAB2 = new Line(ptICB4.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICB6.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

            lenH = botH;
            if (BulkheadCount > 0)
            {
                for (int i = 0; i < numR; i++)
                {
                    if (i > 0)
                        lenH += pierPara.pierRebar.bottom_encryption_spacing;
                    //PLPloter.AddLine(db,ptCB1E.C2D(avg + lenH * pierPara.column.slope_l, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                    Point2d ptV1 = ptCB1E.C2D(avg + (pierPara.pierRebar.pier_v_reinforcement_pilecap_depth + lenH) * pierPara.column.slope_l, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth);
                    double vL = BottomW - avg * 2 - (pierPara.pierRebar.pier_v_reinforcement_pilecap_depth + lenH) * pierPara.column.slope_l * 2;
                    List<Point2d> ptVLst = new List<Point2d>();
                    RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst,pierPara.pierRebar.main_l_change_num);

                    if (i < numRB)
                    {                      
                        Line lineAB11 = new Line(ptVLst[0].C3D(), ptVLst[spancslLst.Count].C3D());
                        Line lineAB12 = new Line(ptVLst[ptVLst.Count - spancslLst.Count].C3D(), ptVLst[ptVLst.Count - 1].C3D());
                        Point3d ptO1 = MathExtensions.GetIntersection(lineAB1, lineAB11);
                        Point3d ptO2 = MathExtensions.GetIntersection(lineAB2, lineAB12);
                        if (isModify)
                        {
                            if (i % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptVLst[0].C2D(), ptO1.C2D(), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptVLst[ptVLst.Count - 1], ptO2.C2D(), ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptVLst[0].C2D(), ptO1.C2D(), ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptVLst[ptVLst.Count - 1], ptO2.C2D(), ref ext, "H钢筋");
                        }
                    }
                    else
                    {
                        if (isModify)
                        {
                            if (i % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptVLst[ptVLst.Count - 1 - spancslLst.Count].C2D(), ptVLst[ptVLst.Count - 1], ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptVLst[ptVLst.Count - 1 - spancslLst.Count].C2D(), ptVLst[ptVLst.Count - 1], ref ext, "H钢筋");
                        }
                    }
                }
            }
            else
            {
                numR = (int)((BH - pierPara.pierRebar.pier_v_reinforcement_pilecap_depth - 10 - 10 * pierPara.pierRebar.middle_encryption_spacing- botH) / pierPara.pierRebar.bottom_encryption_spacing);

                for (int i = 0; i < numR; i++)
                {
                    if (i > 0)
                        lenH += pierPara.pierRebar.bottom_encryption_spacing;
                    Point2d ptV1 = ptCB1E.C2D(avg + (pierPara.pierRebar.pier_v_reinforcement_pilecap_depth + lenH) * pierPara.column.slope_l, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth);
                    double vL = BottomW - avg * 2 - (pierPara.pierRebar.pier_v_reinforcement_pilecap_depth + lenH) * pierPara.column.slope_l * 2;
                    List<Point2d> ptVLst = new List<Point2d>();
                    RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst, pierPara.pierRebar.main_l_change_num);

                    if (i < numRB)
                    {
                        Line lineAB11 = new Line(ptVLst[0].C3D(), ptVLst[spancslLst.Count].C3D());
                        Line lineAB12 = new Line(ptVLst[ptVLst.Count - spancslLst.Count].C3D(), ptVLst[ptVLst.Count - 1].C3D());
                        Point3d ptO1 = MathExtensions.GetIntersection(lineAB1, lineAB11);
                        Point3d ptO2 = MathExtensions.GetIntersection(lineAB2, lineAB12);
                        if (isModify)
                        {
                            if (i % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptVLst[0].C2D(), ptO1.C2D(), ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptVLst[ptVLst.Count - 1], ptO2.C2D(), ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptVLst[0].C2D(), ptO1.C2D(), ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptVLst[ptVLst.Count - 1], ptO2.C2D(), ref ext, "H钢筋");
                        }
                    }
                    else
                    {
                        if (isModify)
                        {
                            if (i % 3 == 0)
                            {
                                PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                                PLPloter.AddLine(db, ptVLst[ptVLst.Count - 1 - spancslLst.Count].C2D(), ptVLst[ptVLst.Count - 1], ref ext, "H钢筋");
                            }
                        }
                        else
                        {
                            PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptVLst[ptVLst.Count - 1 - spancslLst.Count].C2D(), ptVLst[ptVLst.Count - 1], ref ext, "H钢筋");
                        }
                        if (i == numR - 1)
                            ptDimB = ptCB1E.C3D(avg, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth);
                    }
                }
                for (int i = 0; i < 10; i++)
                {
                    lenH += pierPara.pierRebar.middle_encryption_spacing;
                    Point2d ptV1 = ptCB1E.C2D(avg + (pierPara.pierRebar.pier_v_reinforcement_pilecap_depth + lenH) * pierPara.column.slope_l, lenH + pierPara.pierRebar.pier_v_reinforcement_pilecap_depth);
                    double vL = BottomW - avg * 2 - (pierPara.pierRebar.pier_v_reinforcement_pilecap_depth + lenH) * pierPara.column.slope_l * 2;
                    List<Point2d> ptVLst = new List<Point2d>();
                    RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst, pierPara.pierRebar.main_l_change_num);
                    if (isModify)
                    {
                        if (i % 3 == 0)
                        {
                            PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                            PLPloter.AddLine(db, ptVLst[ptVLst.Count - 1 - spancslLst.Count].C2D(), ptVLst[ptVLst.Count - 1], ref ext, "H钢筋");
                        }
                    }
                    else
                    {
                        PLPloter.AddLine(db, ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                        PLPloter.AddLine(db, ptVLst[ptVLst.Count - 1 - spancslLst.Count].C2D(), ptVLst[ptVLst.Count - 1], ref ext, "H钢筋");
                    }
                }
            }
            #endregion

            #region 内轮廓下部
            //ptSt = ptBottomC.C2D(-BottomW * 0.5 + avg + BH * pierPara.column.slope_l, BH);
            //stL = BottomW - 2 * avg - BH * pierPara.column.slope_l * 2;
            //ptTLst = new List<Point2d>();
            //RebarArrangement.ArrangePoint(ptSt, spancslLst, spancmlLst, lenL, stL, out ptTLst);
            //ptEnd = ptBottomC.C2D(-BottomW * 0.5 + avg + (botH + tH) * pierPara.column.slope_l, botH + tH);
            //endL = BottomW - 2 * avg - (botH + tH) * pierPara.column.slope_l * 2;
            //ptBLst = new List<Point2d>();
            //RebarArrangement.ArrangePoint(ptEnd, spancslLst, spancmlLst, lenL, endL, out ptBLst);
            //double BIH = botH + tH;

            ptLst = new List<Point2d>();
       

            //Point2d ptICB1 = ptCB1E.C2D(BH * pierPara.column.slope_l + bottomThickness, BH);
            //Point2d ptICB2 = ptCB2E.C2D(-BH * pierPara.column.slope_l - bottomThickness , BH);
            //Point2d ptICB3 = ptCB1E.C2D(BIH * pierPara.column.slope_l + bottomThickness , BIH);
            //Point2d ptICB4 = ptCB2E.C2D(-BIH * pierPara.column.slope_l - bottomThickness , BIH);


            //Point2d ptICB1 = ptTLst[spancslLst.Count].C2D(pierPara.pierRebar.concrete_protect_layer);
            //Point2d ptICB2 = ptTLst[spanclLst.Count - spancslLst.Count].C2D(-pierPara.pierRebar.concrete_protect_layer);
            //Point2d ptICB3 = ptBLst[spancslLst.Count].C2D(pierPara.pierRebar.concrete_protect_layer);
            //Point2d ptICB4 = ptBLst[spanclLst.Count - spancslLst.Count].C2D(-pierPara.pierRebar.concrete_protect_layer);
            //Point2d ptICB5 = ptICB3.C2D(tw, -tH);
            //Point2d ptICB6 = ptICB4.C2D(-tw, -tH);
            ptLst.Add(ptICB1);
            ptLst.Add(ptICB3);
            ptLst.Add(ptICB5);
            ptLst.Add(ptICB6);
            ptLst.Add(ptICB4);
            ptLst.Add(ptICB2);
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);


            List<Point2d> ptBCLst = new List<Point2d>();
            Point2d ptBC = ptBottomC.C2D(-BottomW * 0.5 + (botH - pierPara.pierRebar.concrete_protect_layer) * pierPara.column.slope_l + avg, botH - pierPara.pierRebar.concrete_protect_layer);
            double endBCL = BottomW - 2 * avg - (botH - pierPara.pierRebar.concrete_protect_layer) * pierPara.column.slope_l * 2;
            RebarArrangement.ArrangePoint(ptBC, spancslLst, spancmlLst, lenL, endBCL, out ptBCLst, pierPara.pierRebar.main_l_change_num);
            for (int m = 0; m < ptBCLst.Count; m++)
            {
                if (m == spancslLst.Count)
                    PLPloter.AddLine(db,ptBCLst[m], ptBCLst[spanclLst.Count - 1 - spancslLst.Count], ref ext, "H钢筋");
            }
            List<Point3d> ptHBLst = new List<Point3d>();
            List<double> ptHBSLst = new List<double>();
            string spBH = "";
            double leB = ptBCLst[ptBCLst.Count-1 - spancslLst.Count].X - ptBCLst[spancslLst.Count].X - 2 * radius-2*tw-2*pierPara.pierRebar.pier_protect_layer;
            SteelBarPileCap.CreateAvgCircleHatchList(db, ref ext, ptBCLst[spancslLst.Count].C2D(radius+ tw+ pierPara.pierRebar.pier_protect_layer),
               radius, leB, leB, pierPara.pierRebar.pier_solid_reinforcement_space, 0, radius, out ptHBLst, out ptHSLst, out spBH, eDirection.E_BOTTOM, true);
            PLPloter.AddLine(db,ptBCLst[0], ptBCLst[ptBCLst.Count - 1], ref ext, "H钢筋");

            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_TOP, ptHBLst, "6a", ptHBLst.Count / 4, ptHBLst.Count / 4, scale, false, 5 * scale);

            List<Point2d> ptCapCLst = new List<Point2d>();
            List<Point2d> ptN7ALst = new List<Point2d>();
            List<double> spaceN7ALst = new List<double>();
            Point2d ptCapC = ptBottomC.C2D(-BottomW * 0.5 - (pierPara.pierRebar.pilecap_penetration_depth) * pierPara.column.slope_l + avg, -pierPara.pierRebar.pilecap_penetration_depth);
            double endCapCL = BottomW - 2 * avg + (pierPara.pierRebar.pilecap_penetration_depth) * pierPara.column.slope_l * 2;
            RebarArrangement.ArrangePoint(ptCapC, spancslLst, spancmlLst, lenL, endCapCL, out ptCapCLst, pierPara.pierRebar.main_l_change_num);
            //for (int i = 0; i < ptBCLst.Count; i++)
            //{
            //    if (i > spancslLst.Count && i < ptBCLst.Count - 1 - spancslLst.Count)
            //    {
            //        if ((i - spancslLst.Count - 1) % 3 == 2)
            //        {
            //            PLPloter.AddLine(db,ptBCLst[i].C2D(-radius), ptCapCLst[i].C2D(-radius), ref ext, "H钢筋");
            //            Line liN7 = new Line(ptBCLst[i].C3D(-radius), ptCapCLst[i].C3D(-radius));
            //            Point2d ptN7D = MathExtensions.GetPointOnTheLine(ptBCLst[i].C2D(-radius), ptCapCLst[i].C2D(-radius), liN7.Length - 40);
            //            ptN7ALst.Add(ptN7D);
            //            if (ptN7ALst.Count > 1)
            //            {
            //                spaceN7ALst.Add(ptN7ALst[ptN7ALst.Count - 1].X - ptN7ALst[ptN7ALst.Count - 2].X);
            //            }
            //        }
            //    }
            //}
            for (int i = 0; i < ptHBLst.Count; i++)
            {
                if ((i) % 3 == 0 || i == ptHBLst.Count - 1)
                {
                    if (i == ptHBLst.Count - 1)
                    {
                        PLPloter.AddLine(db,ptHBLst[i].C2D(radius, radius), ptHBLst[i].C2D(radius, -pierPara.pierRebar.pilecap_penetration_depth - topH + pierPara.pierRebar.concrete_protect_layer + radius), ref ext, "H钢筋");
                        Line liN7 = new Line(ptHBLst[i].C3D(radius, -radius), ptHBLst[i].C3D(radius, -pierPara.pierRebar.beam_penetration_depth - topH + pierPara.pierRebar.concrete_protect_layer + radius));
                        Point2d ptN7D = MathExtensions.GetPointOnTheLine(ptHBLst[i].C2D(radius, -radius), ptHBLst[i].C2D(radius, -pierPara.pierRebar.beam_penetration_depth + topH - pierPara.pierRebar.concrete_protect_layer + radius), liN7.Length - 40);
                        ptN7ALst.Add(ptN7D);
                    }
                    else
                    {
                        PLPloter.AddLine(db,ptHBLst[i].C2D(-radius, radius), ptHBLst[i].C2D(-radius, -pierPara.pierRebar.pilecap_penetration_depth - topH + pierPara.pierRebar.concrete_protect_layer + radius), ref ext, "H钢筋");
                        Line liN7 = new Line(ptHBLst[i].C3D(-radius, radius), ptHBLst[i].C3D(-radius, -pierPara.pierRebar.pilecap_penetration_depth - topH + pierPara.pierRebar.concrete_protect_layer + radius));
                        Point2d ptN7D = MathExtensions.GetPointOnTheLine(ptHBLst[i].C2D(-radius, radius), ptHBLst[i].C2D(-radius, -pierPara.pierRebar.pilecap_penetration_depth - topH + pierPara.pierRebar.concrete_protect_layer + radius), liN7.Length - 40);
                        ptN7ALst.Add(ptN7D);
                    }

                    if (ptN7ALst.Count > 1)
                    {
                        spaceN7ALst.Add(ptN7ALst[ptN7ALst.Count - 1].X - ptN7ALst[ptN7ALst.Count - 2].X);
                    }
                }
            }
            if (pierPara.pierRebar.pilecap_penetration_depth== pierPara.pierRebar.beam_penetration_depth)
                RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptN7ALst[0].C3D(), ArrowDirection.West, new List<double>(), spaceN7ALst, "7", scale, true, 12, 0 * scale);
            else
                RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptN7ALst[0].C3D(), ArrowDirection.West, new List<double>(), spaceN7ALst, "7a", scale, true, 12, 0 * scale);

            PLPloter.AddLine(db,ptBC.C2D(0, -45), ptBC.C2D(endBCL, -45), ref ext, "H钢筋");
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBC.C2D(topThickness * 0.6, -45).C3D(), ArrowDirection.North, new List<double>(), new List<double>(), "8a", scale, true, 5, 0 * scale);
            #region 3#，10#

            l1 = new Line(ptICB3.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICB5.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
            lenLine = l1.Length;


            //lOut1 = new Line(ptCB1.C3D(avg), ptCB1E.C3D(avg));
            //ptOut = MathExtensions.GetIntersection(l1, lOut1);
            //lOut = new Line(ptOut, l1.StartPoint);
            p1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine + lenN3T).C3D();
            p2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenN3).C3D();
            PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            ptALst = new List<Point3d>();
            for (int i = 0; i < (lenN3 / pierPara.pierRebar.pier_angle_reinforcement_space); i++)
            {
                double lenDiv = (lenLine - 2 * radius) * i / (lenN3 / pierPara.pierRebar.pier_angle_reinforcement_space);
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenDiv + radius).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptALst.Add(pp1);
            }
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);

            ptN8 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenLine * 0.2).C3D();
            RebarDimPloter.CreateHookLineMark(db, ref ext, ptN8, "3a", 3 * scale, scale, GeTools.RadianToDegree(ang));
            RebarDimPloter.CreateHookLineMark(db, ref ext, ptALst[ptALst.Count / 2], ptALst, "10", 3 * scale, scale, 360 - GeTools.RadianToDegree(ang));


            l2 = new Line(ptICB4.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICB6.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
            lenLine2 = l2.Length;

            p1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenLine2 + lenN3T).C3D();
            p2 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), -lenN3).C3D();
            PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            ptALst = new List<Point3d>();
            for (int i = 0; i < (lenN3 / pierPara.pierRebar.pier_angle_reinforcement_space); i++)
            {
                double lenDiv = (lenLine2 - 2 * radius) * i / (lenN3 / pierPara.pierRebar.pier_angle_reinforcement_space);
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenDiv + radius).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptALst.Add(pp1);
            }
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);
            #endregion
            #endregion

            #endregion

            #region 承台外轮廓绘制
            double pileCapW = pierPara.column.top_l * 1.6; //pierPara.pileCap.pile_cap_length;
            double pileCapH = pierPara.pileCap.pile_cap_height > pierPara.pierRebar.pilecap_penetration_depth + 3 * scale ? pierPara.pileCap.pile_cap_height : (pierPara.pierRebar.pilecap_penetration_depth + 3 * scale);
            ptLst = new List<Point2d>();
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5));
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5));
            //PLPloter.AddPolylineByPointList(ptLst, ref ext, "H细线", true);

            //DimPloter.DimRot(db, ptBottomC.C3D(-pileCapW * 0.5), ptBottomC.C3D(-pileCapW * 0.5, -pileCapH), ptDim, ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptBottomC.C3D(-pileCapW * 0.5), ptBottomC.C3D(pileCapW * 0.5), ptBottomC.C3D(0,-10*scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);

            #region 钢筋绘制
            //total = 0;
            //for (int i = 0; i < spanPileCapLst.Count; i++)
            //{
            //    total += spanPileCapLst[spanPileCapLst.Count - 1 - i];
            //    if (i == spanPileCapLst.Count - 1)
            //    {
            //        ptSt = ptBottomC.C2D(-BottomW * 0.5 + avg + BH * pierPara.column.slope_l, BH);
            //        stL = BottomW - 2 * avg - BH * pierPara.column.slope_l * 2;
            //        ptTLst = new List<Point2d>();
            //        RebarArrangement.ArrangePoint(ptSt, spancslLst, spancmlLst, lenL, stL, out ptTLst);
            //        ptEnd = ptBottomC.C2D(-BottomW * 0.5 + avg - pierPara.pierRebar.pilecap_penetration_depth * pierPara.column.slope_l, -pierPara.pierRebar.pilecap_penetration_depth);
            //        endL = BottomW - 2 * avg + pierPara.pierRebar.pilecap_penetration_depth * pierPara.column.slope_l * 2;
            //        ptBLst = new List<Point2d>();
            //        RebarArrangement.ArrangePoint(ptEnd, spancslLst, spancmlLst, lenL, endL, out ptBLst);
            //        PLPloter.AddLine(db,ptSt, ptEnd, ref ext, "H钢筋");
            //        for (int m = 0; m < ptTLst.Count; m++)
            //        {
            //            if (m == spancslLst.Count || m == spanclLst.Count - spancslLst.Count || m == spanclLst.Count)
            //                PLPloter.AddLine(db,ptTLst[m], ptBLst[m], ref ext, "H钢筋");
            //        }

            //        DimPloter.DimRot(db, ptBLst[0].C3D(), ptBLst[0].C3D(0, spanPileCapLst[spanPileCapLst.Count - 1 - i]), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //        DimPloter.DimRot(db, ptBottomC.C3D(), ptBLst[0].C3D(0, spanPileCapLst[spanPileCapLst.Count - 1 - i]), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //    }
            //    else
            //    {
            //        //PLPloter.AddLine(db,ptBottomC.C2D(-BottomW * 0.5 + avg - total * pierPara.column.slope_l, -total), ptBottomC.C2D(BottomW * 0.5 - avg + total * pierPara.column.slope_l, -total), ref ext, "H钢筋");
            //        Point2d ptV1 = ptBottomC.C2D(-BottomW * 0.5 + avg - total * pierPara.column.slope_l, -total);
            //        double vL = BottomW - 2 * avg - total * pierPara.column.slope_l * 2;
            //        List<Point2d> ptVLst = new List<Point2d>();
            //        RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);

            //        PLPloter.AddLine(db,ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
            //        PLPloter.AddLine(db,ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
            //    }
            //}
            ptSt = ptBottomC.C2D(-BottomW * 0.5 + avg + BH * pierPara.column.slope_l, BH);
            stL = BottomW - 2 * avg - BH * pierPara.column.slope_l * 2;
            ptTLst = new List<Point2d>();
            RebarArrangement.ArrangePoint(ptSt, spancslLst, spancmlLst, lenL, stL, out ptTLst, pierPara.pierRebar.main_l_change_num);
            ptEnd = ptBottomC.C2D(-BottomW * 0.5 + avg - pierPara.pierRebar.pilecap_penetration_depth * pierPara.column.slope_l, -pierPara.pierRebar.pilecap_penetration_depth);
            endL = BottomW - 2 * avg + pierPara.pierRebar.pilecap_penetration_depth * pierPara.column.slope_l * 2;
            ptBLst = new List<Point2d>();
            RebarArrangement.ArrangePoint(ptEnd, spancslLst, spancmlLst, lenL, endL, out ptBLst, pierPara.pierRebar.main_l_change_num);
            PLPloter.AddLine(db,ptSt, ptEnd, ref ext, "H钢筋");
            for (int m = 0; m < ptTLst.Count; m++)
            {
                if (m == spancslLst.Count || m == ptTLst.Count - spancslLst.Count-1 || m == ptTLst.Count-1)
                    PLPloter.AddLine(db,ptTLst[m], ptBLst[m], ref ext, "H钢筋");
            }
            #endregion
            if (pierPara.pierRebar.top_encryption_length > 0)
            {
                DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptDimT.C3D(), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebar.top_encryption_length / pierPara.pierRebar.top_encryption_spacing + "×" + pierPara.pierRebar.top_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptDimT.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "L-" + pierPara.pierRebar.top_encryption_length / pierPara.pierRebar.top_encryption_spacing + "×" + pierPara.pierRebar.top_encryption_spacing + "-" + pierPara.pierRebar.bottom_encryption_length / pierPara.pierRebar.bottom_encryption_spacing + "×" + pierPara.pierRebar.bottom_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, ptDimT.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "n1×" + pierPara.pierRebar.middle_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            }
            else
            {
                DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "n1×" + pierPara.pierRebar.middle_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            }
            //DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptDimT.C3D(), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebar.top_encryption_length / pierPara.pierRebar.top_encryption_spacing + "×" + pierPara.pierRebar.top_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            ////DimPloter.DimRot(db, ptDimT.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "L-" + pierPara.pierRebar.top_encryption_length / pierPara.pierRebar.top_encryption_spacing + "×" + pierPara.pierRebar.top_encryption_spacing + "-" + pierPara.pierRebar.bottom_encryption_length / pierPara.pierRebar.bottom_encryption_spacing + "×" + pierPara.pierRebar.bottom_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptDimT.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "n1×" + pierPara.pierRebar.middle_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptDimB.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebar.bottom_encryption_length / pierPara.pierRebar.bottom_encryption_spacing + "×" + pierPara.pierRebar.bottom_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            if (pierPara.pierRebar.pier_v_reinforcement_pilecap_depth > 0)
                DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebar.pier_v_reinforcement_pilecap_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);


            //DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBMid.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebar.beam_penetration_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebar.beam_penstration_layout, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBMid.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebar.beam_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, -pierPara.pierRebar.pilecap_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "H", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, -pierPara.pierRebar.pilecap_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);


            //string v = avg + "+" + pierPara.pierRebar.main_l_thickness_layout + "+" + pierPara.pierRebar.main_l_change_num + "*C" + "+" + pierPara.pierRebar.main_l_mid_layout + "+" + pierPara.pierRebar.main_l_change_num + "*C" + "+" + pierPara.pierRebar.main_l_thickness_layout + "+" + avg;
            //DimPloter.DimRot(db, ptBottomC.C3D(-pileCapW * 0.5), ptBottomC.C3D(pileCapW * 0.5), ptBottomC.C3D(0, -pileCapH - 5 * scale), ref ext, 0, scale, v, Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptBottomC.C3D(-pileCapW * 0.5), ptBottomC.C3D(pileCapW * 0.5), ptBottomC.C3D(0, -pileCapH - 10 * scale), ref ext, 0, scale, "Bdi", Unit.Centimeter, Unit.Centimeter);


            #endregion


            List<double> lList = new List<double>();

            for (int i = 0; i < 5; i++)
            {
                lList.Add(pierPara.pierRebar.middle_encryption_spacing);
            }
            for (int i = 0; i < 5; i++)
            {
                lList.Add(pierPara.pierRebar.bottom_encryption_spacing);
            }
            if(BulkheadCount>0)
                RebarPLPloter.CreateLineArrowMultDBNew(db, ref ext, ptDimB.C3D(pierPara.column.top_l + 2 * scale * BulkheadCount - bottomThickness * 0.1, 5 * pierPara.pierRebar.middle_encryption_spacing), ArrowDirection.South, lList, new List<double>(), "4", "4a", scale, true, 1, 5 * scale);
            else
                RebarPLPloter.CreateLineArrowMultDBNew(db, ref ext, ptDimB.C3D(pierPara.column.top_l +  bottomThickness * 0.65, 5 * pierPara.pierRebar.middle_encryption_spacing), ArrowDirection.South, lList, new List<double>(), "4", "4a", scale, true, 1, 5 * scale);
        }
        #endregion

        #endregion

        #region 墩柱截面

        public void PlotSectionEE_bak(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "E-E", "", scale);
            Point2d pt = insertPoint.C2D(0, -20 * scale);

            double W = pierPara.column.top_w;
            double L = pierPara.column.top_l;
            //if (pierPara.column.slope_w > 0)
            //    W = W + 100;
            //if (pierPara.column.slope_l > 0)
            //    L = L + 30;

            double lenW = Math.Round(spancwLst.Sum(), 1);
            double avg = Math.Round((pierPara.column.top_w - lenW) * 0.5,1);
            double lenL = Math.Round(spanclLst.Sum(), 1);
            double avgl = Math.Round((pierPara.column.top_l - lenL) * 0.5,1);


            string[] sizeOut = pierPara.column.out_section_ang.Split('*');
            string[] sizeInner = pierPara.column.inner_section_ang.Split('*');
            double outW = double.Parse(sizeOut[0]);
            double outL = double.Parse(sizeOut[1]);
            double innerW = double.Parse(sizeInner[0]);
            double innerL = double.Parse(sizeInner[1]);
            ObjectId pLId1 = PLPloter.CreatPoly8(db,pt.C2D(), ref ext, L, W, "H细线", outL, outW, outL, outW);

            Polyline pLId2 = PLPloter.CreatPoly8Polyline(db, pt.C2D(0, -topThickness), ref ext, L - 2 * topThickness, W - 2 * topThickness, "H细线", innerW, innerL, innerW, innerL);

            ObjectId pLId3 = PLPloter.CreatPoly8(db, pt.C2D(0, -avg + radius), ref ext, L - avg * 2 + radius * 2, W - avg * 2 + radius * 2, "H钢筋", outL, outW, outL, outW);

            List<Point3d> reLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -avgl),
                    radius, spancwLst, scale, 0, out reLst, false);
            List<Point3d> reBLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
             radius, spancwLst, scale, 0, out reBLst, false);

            //List<Point3d> reLLst = new List<Point3d>();
            //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
            //radius, spanclLst, scale, 0, out reLLst, false, false);

            //List<Point3d> reRLst = new List<Point3d>();
            //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(W * 0.5 - avg, -L + avgl),
            //radius, spanclLst, scale, 0, out reRLst, false, false);
            double vL = L - 2 * avg;
            List<double> vLst = new List<double>();
            string dimC = "C";
            RebarArrangement.ArrangeSpan(spancslLst, spancmlLst, lenL, vL, out vLst, 0);
            List<Point3d> reLLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
            radius, vLst, scale, 0, out reLLst, false, false);
            List<Point3d> reRLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(W * 0.5 - avg, -L + avgl),
            radius, vLst, scale, 0, out reRLst, false, false);

            double sw = spancsLst.Sum();
            double sl = spancslLst.Sum();
            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg + sw + radius, -avgl + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + avgl - radius), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg - sw - radius, -avgl + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + avgl - radius), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -avgl - sl - radius), pt.C2D(W * 0.5 - avg + radius, -avgl - sl - radius), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + avgl + sl + radius), pt.C2D(W * 0.5 - avg + radius, -L + avgl + sl + radius), ref ext, "H钢筋");

            DimPloter.DimRadius(db,pt.C3D(W * 0.25, 0), pt.C3D(W * 0.25, 0.01), 2 * scale, ref ext, scale, "净" + pierPara.pierRebar.concrete_protect_layer);
            //string v = avg + "+" + pierPara.pierRebar.main_w_thickness_layout + "+" + pierPara.pierRebar.main_w_angle_layout + "+" + pierPara.pierRebar.main_w_mid_layout + "+" + pierPara.pierRebar.main_w_angle_layout + "+" + pierPara.pierRebar.main_w_thickness_layout + "+" + avg;
            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), reLst[0], pt.C3D(0, 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter,1);
            DimPloter.DimRot(db, pt.C3D(pierPara.column.top_w * 0.5), reLst[reLst.Count-1], pt.C3D(0, 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter,1);
            //DimPloter.DimRot(db, reLst[0], reLst[spancsLst.Count], pt.C3D(0, 5 * scale), ref ext, 0, scale, dimWSideString, Unit.Centimeter, Unit.Centimeter, 1);
            //DimPloter.DimRot(db, reLst[reLst.Count-1- spancsLst.Count], reLst[reLst.Count - 1], pt.C3D(0, 5 * scale), ref ext, 0, scale, dimWSideString, Unit.Centimeter, Unit.Centimeter, 1);
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), reLst[0], pt.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, reLst[0], reLst[reLst.Count - 1], pt.C3D(0, 10 * scale), ref ext, 0, scale, dimWSideString+"+"+ dimWMidString + "+"+ dimWSideString, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 15 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);

            ////string vl = avg + "+" + pierPara.pierRebar.main_l_thickness_layout + "+" + pierPara.pierRebar.main_l_mid_layout + "+" + pierPara.pierRebar.main_l_thickness_layout + "+" + avg;
            //string vl = avg + "+" + pierPara.pierRebar.main_l_thickness_layout + "+" + "C" + "+" + pierPara.pierRebar.main_l_mid_layout + "+" + "C" + "+" + pierPara.pierRebar.main_l_thickness_layout + "+" + avg;
            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5, 0), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, dimLString, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);

            #region 内部点筋
            List<Point3d> ptTLst = new List<Point3d>();
            List<Point3d> ptBLst = new List<Point3d>();

            List<Point3d> ptLLst = new List<Point3d>();
            List<Point3d> ptRLst = new List<Point3d>();

            List<Point3d> ptLTLst = new List<Point3d>();
            List<Point3d> ptRTLst = new List<Point3d>();
            List<Point3d> ptLBLst = new List<Point3d>();
            List<Point3d> ptRBLst = new List<Point3d>();

            double ang = Math.Atan(innerW / innerL);
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                BlockTable blockTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
                LayerTable lt = tr.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable;
                BlockTableRecord modelSpace;
                modelSpace = tr.GetObject(blockTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
                Polyline PL1 = pLId2;
                Polyline PL = tr.GetObject(pLId3, OpenMode.ForRead) as Polyline;
                LineSegment2d li = PL.GetLineSegment2dAt(0);
                Line line1 = PL.GetLineSegment2dAt(0).CLine();
                Line line2 = PL.GetLineSegment2dAt(2).CLine();
                Line line3 = PL.GetLineSegment2dAt(4).CLine();
                Line line4 = PL.GetLineSegment2dAt(6).CLine();

                LineSegment2d li0 = PL1.GetLineSegment2dAt(0);
                LineSegment2d li2 = PL1.GetLineSegment2dAt(2);

                int stIndex = 0;
                int endIndex = 0;
                int stlIndex = 0;
                int endlIndex = 0;
                Point2d pt1 = pt.C2D(-W * 0.5 + avg + sw + radius, -avgl + radius);
                Point2d pt2 = pt.C2D(W * 0.5 - avg - sw - radius, -L + avgl - radius);
                Point2d pt3 = pt.C2D(-W * 0.5 + avg - radius, -avgl - sl - radius);
                Point2d pt4 = pt.C2D(-W * 0.5 + avg - radius, -L + avgl + sl + radius);

                int div = 0;
                List<double> n8Lst = new List<double>();
                List<Point3d> n8PtLst = new List<Point3d>();
                List<double> n8aLst = new List<double>();
                List<Point3d> n8aPtLst = new List<Point3d>();
                for (int i = 0; i < reLst.Count; i++)
                {
                    if (reLst[i].X >= li0.StartPoint.X && reLst[i].X <= li0.EndPoint.X)
                    {
                        ptTLst.Add(new Point3d(reLst[i].X, pt3.Y + radius, 0));
                        ptBLst.Add(new Point3d(reLst[i].X, pt4.Y - radius, 0));
                      
                        if ((div)%3==0||div==spancmLst.Count-2)
                        {
                            if (div == spancmLst.Count - 2)
                            {
                                int di = div % 3;
                                PLPloter.AddLine(db,reLst[i + di].C2D(radius, radius), reBLst[i + di].C2D(radius, -radius), ref ext, "H钢筋");
                                n8aPtLst.Add(reLst[i + di].C3D(radius, radius));
                                if (n8aPtLst.Count > 1)
                                {
                                    n8aLst.Add(n8aPtLst[n8aPtLst.Count - 1].X - n8aPtLst[n8aPtLst.Count - 2].X);
                                }
                            }
                            else
                            {
                                PLPloter.AddLine(db,reLst[i].C2D(-radius, radius), reBLst[i].C2D(-radius, -radius), ref ext, "H钢筋");
                                n8aPtLst.Add(reLst[i].C3D(-radius, radius));
                                if(n8aPtLst.Count>1)
                                {
                                    n8aLst.Add(n8aPtLst[n8aPtLst.Count-1].X- n8aPtLst[n8aPtLst.Count - 2].X);
                                }
                            }
                        }
                       
                        div++;
                    }
                    else
                    {
                        if(reLst[i].X < li0.StartPoint.X)
                        {
                            n8aPtLst.Add(reLst[spancsLst.Count].C3D(radius, radius));
                            if (n8aPtLst.Count > 1)
                            {
                                n8aLst.Add(n8aPtLst[n8aPtLst.Count - 1].X - n8aPtLst[n8aPtLst.Count - 2].X);
                            }
                        }

                        if (reLst[i].X > li0.EndPoint.X)
                        {
                            n8aPtLst.Add(reLst[reLst.Count-1-spancsLst.Count].C3D(-radius, radius));
                            if (n8aPtLst.Count > 1)
                            {
                                n8aLst.Add(n8aPtLst[n8aPtLst.Count - 1].X - n8aPtLst[n8aPtLst.Count - 2].X);
                            }
                        }
                    }
                }
                div = 0;
                for (int i = 0; i < reLLst.Count; i++)
                {
                    if (reLLst[i].Y <= li2.StartPoint.Y && reLLst[i].Y >= li2.EndPoint.Y)
                    {
                        ptLLst.Add(new Point3d(pt1.X - radius, reLLst[i].Y, 0));
                        ptRLst.Add(new Point3d(pt2.X + radius, reLLst[i].Y, 0));

                        if ((div) % 3 == 0 || div == spancmLst.Count - 2)
                        {
                            if (div == spancmLst.Count - 2)
                            {
                                int di = div % 3;
                                PLPloter.AddLine(db,reLLst[i + di].C2D(-radius, radius), reRLst[i + di].C2D(radius, radius), ref ext, "H钢筋");
                                n8PtLst.Add(reLLst[i + di].C3D(-radius, radius));
                                if (n8PtLst.Count > 1)
                                {
                                    n8Lst.Add(n8PtLst[n8PtLst.Count - 1].Y - n8PtLst[n8PtLst.Count - 2].Y);
                                }
                            }
                            else
                            {
                                PLPloter.AddLine(db,reLLst[i].C2D(-radius, -radius), reRLst[i].C2D(radius, -radius), ref ext, "H钢筋");
                                n8PtLst.Add(reLLst[i].C3D(-radius, -radius));
                                if (n8PtLst.Count > 1)
                                {
                                    n8Lst.Add(n8PtLst[n8PtLst.Count - 1].Y - n8PtLst[n8PtLst.Count - 2].Y);
                                }
                            }
                        }
                        div++;
                    }
                    else
                    {
                        if (reLLst[i].Y <li2.EndPoint.Y)
                        {
                            n8PtLst.Add(reLLst[spancsLst.Count].C3D(-radius, radius));
                            if (n8Lst.Count > 1)
                            {
                                n8Lst.Add(n8PtLst[n8PtLst.Count - 1].Y - n8PtLst[n8PtLst.Count - 2].Y);
                            }
                        }

                        if (reLLst[i].Y > li2.StartPoint.Y)
                        {
                            n8PtLst.Add(reLLst[reLLst.Count - 1 - spancsLst.Count].C3D(-radius, -radius));
                            if (n8Lst.Count > 1)
                            {
                                n8Lst.Add(n8PtLst[n8PtLst.Count - 1].Y - n8PtLst[n8PtLst.Count - 2].Y);
                            }
                        }
                    }
                }

                n8Lst.Reverse();
                RebarPLPloter.CreateLineArrowDBNew(db, ref ext, n8PtLst[n8PtLst.Count-1].C3D(topThickness*0.45), ArrowDirection.North, n8Lst, new List<double>(), "8", scale, true, 10, 0);
                RebarPLPloter.CreateLineArrowDBNew(db, ref ext, n8aPtLst[0].C3D(0,-topThickness * 0.45), ArrowDirection.West, new List<double>(), n8aLst, "8a", scale, true, 0, 4*scale);
                N8N = n8PtLst.Count;
                N8aN = n8aPtLst.Count;
                LineSegment2d li1 = PL1.GetLineSegment2dAt(1);

                Line l1 = new Line(li1.StartPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li1.EndPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

                double lenLine = l1.Length;
                Point3d p1 = MathExtensions.GetIntersection(l1, line1);
                Point3d p2 = MathExtensions.GetIntersection(l1, line2);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine / 3).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                Point3d pp2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine * 2 / 3).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptRTLst.Add(pp1);
                ptRTLst.Add(pp2);

                LineSegment2d li3 = PL1.GetLineSegment2dAt(3);
                Line l3 = new Line(li3.StartPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li3.EndPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

                p1 = MathExtensions.GetIntersection(l3, line2);
                p2 = MathExtensions.GetIntersection(l3, line3);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                pp1 = MathExtensions.GetPointOnTheLine(l3.StartPoint.C2D(), l3.EndPoint.C2D(), lenLine / 3).C3D(radius * Math.Cos(ang), -radius * Math.Sin(ang));
                pp2 = MathExtensions.GetPointOnTheLine(l3.StartPoint.C2D(), l3.EndPoint.C2D(), lenLine * 2 / 3).C3D(radius * Math.Cos(ang), -radius * Math.Sin(ang));
                ptRBLst.Add(pp1);
                ptRBLst.Add(pp2);

                LineSegment2d li5 = PL1.GetLineSegment2dAt(5);
                Line l5 = new Line(li5.StartPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li5.EndPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

                p1 = MathExtensions.GetIntersection(l5, line3);
                p2 = MathExtensions.GetIntersection(l5, line4);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                pp1 = MathExtensions.GetPointOnTheLine(l5.StartPoint.C2D(), l5.EndPoint.C2D(), lenLine / 3).C3D(-radius * Math.Cos(ang), -radius * Math.Sin(ang));
                pp2 = MathExtensions.GetPointOnTheLine(l5.StartPoint.C2D(), l5.EndPoint.C2D(), lenLine * 2 / 3).C3D(-radius * Math.Cos(ang), -radius * Math.Sin(ang));
                ptLBLst.Add(pp1);
                ptLBLst.Add(pp2);

                LineSegment2d li7 = PL1.GetLineSegment2dAt(7);
                Line l7 = new Line(li7.StartPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li7.EndPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

                p1 = MathExtensions.GetIntersection(l7, line1);
                p2 = MathExtensions.GetIntersection(l7, line4);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                Line lineN3a = new Line(p1, p2);
                lenN3a = Math.Round(lineN3a.Length, 1);
                pp1 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine / 3).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                pp2 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine * 2 / 3).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptLTLst.Add(pp1);
                ptLTLst.Add(pp2);
                Point3d ptN5 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine / 2).C3D();
                RebarDimPloter.CreateHookLineMark(db, ref ext, ptN5, "3b", 3 * scale, scale, 315);
                tr.Commit();
            }
            //10
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptTLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptBLst, scale, 0, false);

            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRLst, scale, 0, false);

            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRTLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRBLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLTLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLBLst, scale, 0, false);

            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_LEFT, ptRLst, "2a", 1, 0, scale, false, 3 * scale);
            SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_BOTTOM, ptBLst, "2b", ptBLst.Count / 15, ptBLst.Count / 10, scale, false, 3.5 * scale);
            SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_TOP, reBLst, "1", ptBLst.Count / 15, ptBLst.Count / 10, scale, false, 4.5 * scale);

            //SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_RIGHT, reRLst, "1b", reRLst.Count / 4, reRLst.Count / 4, scale, false, 4.5 * scale);

            //List<Point3d> listN1T = new List<Point3d>();
            //List<Point3d> listN1M = new List<Point3d>();
            //List<Point3d> listN1B = new List<Point3d>();
            //List<Point3d> listN2T = new List<Point3d>();
            //List<Point3d> listN2B = new List<Point3d>();
            //for (int i = 0; i < reRLst.Count; i++)
            //{
            //    if (i <= spancslLst.Count)
            //        listN1T.Add(reRLst[i]);
            //    else if (i > spancslLst.Count && i <= spancslLst.Count + spancmlLst.Count + 1)
            //        listN1M.Add(reRLst[i]);
            //    else
            //        listN1B.Add(reRLst[i]);
            //}
            List<Point3d> listN1T = new List<Point3d>();
            List<Point3d> listN1M = new List<Point3d>();
            List<Point3d> listN1B = new List<Point3d>();
            //List<Point3d> listN2T = new List<Point3d>();
            //List<Point3d> listN2B = new List<Point3d>();
            //for (int i = 0; i < reRLst.Count; i++)
            for (int i = 1; i < reRLst.Count - 1; i++)
            {
                if (i <= spancslLst.Count)
                    listN1T.Add(reRLst[i]);            
                else if (i > spancslLst.Count  && i < spancslLst.Count + spancmlLst.Count)
                    listN1M.Add(reRLst[i]);            
                else
                    listN1B.Add(reRLst[i]);
            }

            SteelBarPileCap.CreateLineList(db, ref ext, listN1T, eDirection.E_RIGHT, 5 * scale, "H细线");
            Point3d pttxt = GeTools.MidPoint(listN1T[0], listN1T[listN1T.Count - 1]);
            TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "1a", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            SteelBarPileCap.CreateLineList(db, ref ext, listN1M, eDirection.E_RIGHT, 5 * scale, "H细线");
            pttxt = GeTools.MidPoint(listN1M[0], listN1M[listN1M.Count - 1]);
            TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "1b", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            SteelBarPileCap.CreateLineList(db, ref ext, listN1B, eDirection.E_RIGHT, 5 * scale, "H细线");
            pttxt = GeTools.MidPoint(listN1B[0], listN1B[listN1B.Count - 1]);
            TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "1a", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);


            #endregion



            #region  箍筋
            //List<double> lstLenWSList = new List<double>();
            //List<double> lstLenLSList = new List<double>();
            //int num = spancmLst.Count / pierPara.pierRebar.stirrup_count;
            //if (spancmLst.Count % pierPara.pierRebar.stirrup_count >= pierPara.pierRebar.stirrup_count * 0.25)
            //{
            //    num = num + 1;
            //}
            //List<double> lst = new List<double>();
            //int neA = (int)((pierPara.pierRebar.stirrup_count * num - spancmLst.Count) * 0.5);
            //if (neA > 0)
            //{
            //    for (int i = neA; i > 0; i--)
            //    {
            //        lst.Add(spancaLst[spancaLst.Count - neA]);
            //    }
            //    for (int i = 0; i < spancmLst.Count; i++)
            //    {
            //        lst.Add(spancmLst[spancmLst.Count - neA]);
            //    }
            //    for (int i = neA; i > 0; i--)
            //    {
            //        lst.Add(spancaLst[spancaLst.Count - neA]);
            //    }
            //}
            //else
            //{
            //    lst = spancmLst;
            //    if (lst.Count % pierPara.pierRebar.stirrup_count != 0)
            //    {
            //        for (int i = lst.Count; i < num * pierPara.pierRebar.stirrup_count; i++)
            //        {
            //            lst.Add(lst[0]);
            //        }
            //    }
            //}
            //double wlen = lst.Sum() + 2 * radius;
            //double les = 0;
            //double les0 = 0;
            //Point2d ptS = pt.C2D(-wlen * 0.5, -avgl + radius);
            //Point2d ptBS = pt.C2D(-wlen * 0.5, -L + avgl - radius + sl + radius * 2);
            //for (int i = 0; i < lst.Count; i++)
            //{
            //    les0 += lst[i];
            //    les += lst[i];
            //    if ((i + 1) % pierPara.pierRebar.stirrup_count == 0)
            //    {
            //        PLPloter.AddPloy4(ptS.C2D(les0 - les + les * 0.5 + radius), les * 0.5 + radius, les * 0.5 + radius, sl + radius * 2, ref ext, "H钢筋");
            //        PLPloter.AddPloy4(ptBS.C2D(les0 - les + les * 0.5 + radius), les * 0.5 + radius, les * 0.5 + radius, sl + radius * 2, ref ext, "H钢筋");
            //        lstLenWSList.Add(les);
            //        les = 0;
            //    }
            //}

            //int numl = spancmlLst.Count / pierPara.pierRebar.stirrup_count;
            ////if (spancmlLst.Count % pierPara.pierRebar.stirrup_count > pierPara.pierRebar.stirrup_count * 0.5)
            ////{
            ////    numl = numl + 1;
            ////}
            //List<double> lLst = new List<double>();
            //int neLA = (int)((pierPara.pierRebar.stirrup_count * numl - spancmlLst.Count) * 0.5);
            //if (neLA > 0)
            //{
            //    for (int i = neLA; i > 0; i--)
            //    {
            //        lLst.Add(spancslLst[spancslLst.Count - neLA]);
            //    }
            //    for (int i = 0; i < spancmlLst.Count; i++)
            //    {
            //        lLst.Add(spancmlLst[i]);
            //    }
            //    for (int i = neLA; i > 0; i--)
            //    {
            //        lLst.Add(spancslLst[spancslLst.Count - neLA]);
            //    }
            //}
            //else
            //{
            //    if (spancmlLst.Count > pierPara.pierRebar.stirrup_count * numl)
            //    {
            //        for (int i = 0; i < numl * pierPara.pierRebar.stirrup_count; i++)
            //        {
            //            lLst.Add(spancmlLst[i]);
            //        }
            //    }
            //    else
            //    {
            //        lLst = spancmlLst;
            //        if (lLst.Count % pierPara.pierRebar.stirrup_count != 0)
            //        {
            //            for (int i = lLst.Count; i < numl * pierPara.pierRebar.stirrup_count; i++)
            //            {
            //                lLst.Add(lst[0]);
            //            }
            //        }
            //    }
            //}
            //double wLlen = lLst.Sum();
            //les = 0;
            //les0 = 0;
            //Point2d ptS1 = pt.C2D(-pierPara.column.top_w * 0.5 + avg + sw * 0.5, -avgl - sl - pierPara.pierRebar.main_l_space);
            //Point2d ptBS1 = pt.C2D(pierPara.column.top_w * 0.5 - avg - sw * 0.5, -avgl - sl - pierPara.pierRebar.main_l_space);
            //int div = 0;
            //bool isAdd = false;
            //for (int i = 0; i < lLst.Count; i++)
            //{
            //    les0 += lLst[i];
            //    les += lLst[i];
            //    if (lLst.Count % pierPara.pierRebar.stirrup_count == 0)
            //    {
            //        if ((i + 1) % pierPara.pierRebar.stirrup_count == 0)
            //        {
            //            PLPloter.AddPloy4(ptS1.C2D(0, -(les0 - les - radius)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
            //            PLPloter.AddPloy4(ptBS1.C2D(0, -(les0 - les - radius)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
            //            lstLenLSList.Add(les);
            //            les = 0;
            //        }
            //    }               

            //}
            #endregion

            #region 实心段钢筋网

            #endregion

            List<double> lList = new List<double>();
            lList.Add(sl + radius * 2);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, pt.C3D(pierPara.column.top_w * 0.15+5, -L + avgl-radius), ArrowDirection.North, new List<double>(), new List<double>(), "3", scale, true, 5, 0);

            //lList = new List<double>();
            //lList.Add(sw + radius * 2);
            //RebarPLPloter.CreateLineArrowDBNew(db, ref ext, pt.C3D(pierPara.column.top_w * 0.5 - avg - sw - radius, -L * 0.3 - 5), ArrowDirection.West, new List<double>(), lList, "5", scale, true, 7, 0);

            //lList = new List<double>();
            //lList.Add(sw + radius * 2);
            //RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBS1.C3D(0, radius), ArrowDirection.North, lstLenLSList, new List<double>(), "5a", scale, false, 13, 0);

            //lList = new List<double>();
            //lList.Add(sw + radius * 2);
            //RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptS.C3D(0, -sl * 0.5), ArrowDirection.West, new List<double>(), lstLenWSList, "4a", scale, false, 18, 0);




        }

        public void PlotSectionEE(ref Database db, out Extents2d ext, Point2d insertPoint, double scale)
        {
           
            scale = scale * extendscale;
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db, insertPoint, ref ext, "E-E", "", scale);
            Point2d pt = insertPoint.C2D(0, -20 * scale);

            double W = pierPara.column.top_w;
            double L = pierPara.column.top_l;
            //if (pierPara.column.slope_w > 0)
            //    W = W + 100;
            //if (pierPara.column.slope_l > 0)
            //    L = L + 30;

            double lenW = Math.Round(spancwLst.Sum(), 1);
            double avg = Math.Round((pierPara.column.top_w - lenW) * 0.5, 1);
            double lenL = Math.Round(spanclLst.Sum(), 1);
            double avgl = Math.Round((pierPara.column.top_l - lenL) * 0.5, 1);


            string[] sizeOut = pierPara.column.out_section_ang.Split('*');
            string[] sizeInner = pierPara.column.inner_section_ang.Split('*');
            double outW = double.Parse(sizeOut[0]);
            double outL = double.Parse(sizeOut[1]);
            double innerW = double.Parse(sizeInner[0]);
            double innerL = double.Parse(sizeInner[1]);
            ObjectId pLId1 = PLPloter.CreatPoly8(db, pt.C2D(), ref ext, L, W, "H细线", outL, outW, outL, outW);

            Polyline pLId2 = PLPloter.CreatPoly8Polyline(db, pt.C2D(0, -topThickness), ref ext, L - 2 * topThickness, W - 2 * topThickness, "H细线", innerW, innerL, innerW, innerL);

            ObjectId pLId3 = PLPloter.CreatPoly8(db, pt.C2D(0, -avg + radius), ref ext, L - avg * 2 + radius * 2, W - avg * 2 + radius * 2, "H钢筋", outL, outW, outL, outW);

            List<Point3d> reLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -avgl),
                    radius, spancwLst, scale, 0, out reLst, false);
            List<Point3d> reBLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
             radius, spancwLst, scale, 0, out reBLst, false);

            //List<Point3d> reLLst = new List<Point3d>();
            //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
            //radius, spanclLst, scale, 0, out reLLst, false, false);

            //List<Point3d> reRLst = new List<Point3d>();
            //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(W * 0.5 - avg, -L + avgl),
            //radius, spanclLst, scale, 0, out reRLst, false, false);
            double vL = L - 2 * avg;
            List<double> vLst = new List<double>();
            string dimC = "C";
            RebarArrangement.ArrangeSpan(spancslLst, spancmlLst, lenL, vL, out vLst, 0);
            List<Point3d> reLLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
            radius, vLst, scale, 0, out reLLst, false, false);
            List<Point3d> reRLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(W * 0.5 - avg, -L + avgl),
            radius, vLst, scale, 0, out reRLst, false, false);

            double sw = spancsLst.Sum();
            double sl = spancslLst.Sum();
            PLPloter.AddLine(db, pt.C2D(-W * 0.5 + avg + sw + radius, -avgl + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + avgl - radius), ref ext, "H钢筋");
            PLPloter.AddLine(db, pt.C2D(W * 0.5 - avg - sw - radius, -avgl + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + avgl - radius), ref ext, "H钢筋");
            PLPloter.AddLine(db, pt.C2D(-W * 0.5 + avg - radius, -avgl - sl - radius), pt.C2D(W * 0.5 - avg + radius, -avgl - sl - radius), ref ext, "H钢筋");
            PLPloter.AddLine(db, pt.C2D(-W * 0.5 + avg - radius, -L + avgl + sl + radius), pt.C2D(W * 0.5 - avg + radius, -L + avgl + sl + radius), ref ext, "H钢筋");

            #region 标注
            //DimPloter.DimRadius(db, pt.C3D(W * 0.25, 0), pt.C3D(W * 0.25, 0.01), 2 * scale, ref ext, scale, "净" + pierPara.pierRebar.concrete_protect_layer);
            ////string v = avg + "+" + pierPara.pierRebar.main_w_thickness_layout + "+" + pierPara.pierRebar.main_w_angle_layout + "+" + pierPara.pierRebar.main_w_mid_layout + "+" + pierPara.pierRebar.main_w_angle_layout + "+" + pierPara.pierRebar.main_w_thickness_layout + "+" + avg;
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), reLst[0], pt.C3D(0, 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            //DimPloter.DimRot(db, pt.C3D(pierPara.column.top_w * 0.5), reLst[reLst.Count - 1], pt.C3D(0, 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            ////DimPloter.DimRot(db, reLst[0], reLst[spancsLst.Count], pt.C3D(0, 5 * scale), ref ext, 0, scale, dimWSideString, Unit.Centimeter, Unit.Centimeter, 1);
            ////DimPloter.DimRot(db, reLst[reLst.Count-1- spancsLst.Count], reLst[reLst.Count - 1], pt.C3D(0, 5 * scale), ref ext, 0, scale, dimWSideString, Unit.Centimeter, Unit.Centimeter, 1);
            ////DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), reLst[0], pt.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            //DimPloter.DimRot(db, reLst[0], reLst[reLst.Count - 1], pt.C3D(0, 10 * scale), ref ext, 0, scale, dimWSideString + "+" + dimWMidString + "+" + dimWSideString, Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 15 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);

            //////string vl = avg + "+" + pierPara.pierRebar.main_l_thickness_layout + "+" + pierPara.pierRebar.main_l_mid_layout + "+" + pierPara.pierRebar.main_l_thickness_layout + "+" + avg;
            ////string vl = avg + "+" + pierPara.pierRebar.main_l_thickness_layout + "+" + "C" + "+" + pierPara.pierRebar.main_l_mid_layout + "+" + "C" + "+" + pierPara.pierRebar.main_l_thickness_layout + "+" + avg;
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5, 0), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, dimLString, Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            #endregion

            DimPloter.DimRadiusExtend(db, pt.C3D(W * 0.25, 0), pt.C3D(W * 0.25, 0.01), 2 * scale, ref ext, scale/extendscale, extendscale, "净" + pierPara.pierRebar.concrete_protect_layer);          
            DimPloter.DimRotExtend(db, pt.C3D(-pierPara.column.top_w * 0.5), reLst[0], pt.C3D(0, 10 * scale), ref ext, 0, scale / extendscale, extendscale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRotExtend(db, pt.C3D(pierPara.column.top_w * 0.5), reLst[reLst.Count - 1], pt.C3D(0, 10 * scale), ref ext, 0, scale / extendscale, extendscale, "", Unit.Centimeter, Unit.Centimeter, 1);

            DimPloter.DimRotExtend(db, reLst[0], reLst[reLst.Count - 1], pt.C3D(0, 10 * scale), ref ext, 0, scale / extendscale, extendscale, dimWSideString + "+" + dimWMidString + "+" + dimWSideString, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRotExtend(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 15 * scale), ref ext, 0, scale / extendscale, extendscale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRotExtend(db, pt.C3D(-pierPara.column.top_w * 0.5, 0), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale / extendscale, extendscale, dimLString, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRotExtend(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale / extendscale, extendscale, "", Unit.Centimeter, Unit.Centimeter);
            #region 内部点筋
            List<Point3d> ptTLst = new List<Point3d>();
            List<Point3d> ptBLst = new List<Point3d>();

            List<Point3d> ptLLst = new List<Point3d>();
            List<Point3d> ptRLst = new List<Point3d>();

            List<Point3d> ptLTLst = new List<Point3d>();
            List<Point3d> ptRTLst = new List<Point3d>();
            List<Point3d> ptLBLst = new List<Point3d>();
            List<Point3d> ptRBLst = new List<Point3d>();

            double ang = Math.Atan(innerW / innerL);
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                BlockTable blockTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
                LayerTable lt = tr.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable;
                BlockTableRecord modelSpace;
                modelSpace = tr.GetObject(blockTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
                Polyline PL1 = pLId2;
                Polyline PL = tr.GetObject(pLId3, OpenMode.ForRead) as Polyline;
                LineSegment2d li = PL.GetLineSegment2dAt(0);
                Line line1 = PL.GetLineSegment2dAt(0).CLine();
                Line line2 = PL.GetLineSegment2dAt(2).CLine();
                Line line3 = PL.GetLineSegment2dAt(4).CLine();
                Line line4 = PL.GetLineSegment2dAt(6).CLine();

                LineSegment2d li0 = PL1.GetLineSegment2dAt(0);
                LineSegment2d li2 = PL1.GetLineSegment2dAt(2);

                int stIndex = 0;
                int endIndex = 0;
                int stlIndex = 0;
                int endlIndex = 0;
                Point2d pt1 = pt.C2D(-W * 0.5 + avg + sw + radius, -avgl + radius);
                Point2d pt2 = pt.C2D(W * 0.5 - avg - sw - radius, -L + avgl - radius);
                Point2d pt3 = pt.C2D(-W * 0.5 + avg - radius, -avgl - sl - radius);
                Point2d pt4 = pt.C2D(-W * 0.5 + avg - radius, -L + avgl + sl + radius);

                int div = 0;
                List<double> n8Lst = new List<double>();
                List<Point3d> n8PtLst = new List<Point3d>();
                List<double> n8aLst = new List<double>();
                List<Point3d> n8aPtLst = new List<Point3d>();
                for (int i = 0; i < reLst.Count; i++)
                {
                    if (reLst[i].X >= li0.StartPoint.X && reLst[i].X <= li0.EndPoint.X)
                    {
                        ptTLst.Add(new Point3d(reLst[i].X, pt3.Y + radius, 0));
                        ptBLst.Add(new Point3d(reLst[i].X, pt4.Y - radius, 0));

                        if ((div) % 3 == 0 || div == spancmLst.Count - 2)
                        {
                            if (div == spancmLst.Count - 2)
                            {
                                int di = div % 3;
                                PLPloter.AddLine(db, reLst[i + di].C2D(radius, radius), reBLst[i + di].C2D(radius, -radius), ref ext, "H钢筋");
                                n8aPtLst.Add(reLst[i + di].C3D(radius, radius));
                                if (n8aPtLst.Count > 1)
                                {
                                    n8aLst.Add(n8aPtLst[n8aPtLst.Count - 1].X - n8aPtLst[n8aPtLst.Count - 2].X);
                                }
                            }
                            else
                            {
                                PLPloter.AddLine(db, reLst[i].C2D(-radius, radius), reBLst[i].C2D(-radius, -radius), ref ext, "H钢筋");
                                n8aPtLst.Add(reLst[i].C3D(-radius, radius));
                                if (n8aPtLst.Count > 1)
                                {
                                    n8aLst.Add(n8aPtLst[n8aPtLst.Count - 1].X - n8aPtLst[n8aPtLst.Count - 2].X);
                                }
                            }
                        }

                        div++;
                    }
                    else
                    {
                        if (reLst[i].X < li0.StartPoint.X)
                        {
                            n8aPtLst.Add(reLst[spancsLst.Count].C3D(radius, radius));
                            if (n8aPtLst.Count > 1)
                            {
                                n8aLst.Add(n8aPtLst[n8aPtLst.Count - 1].X - n8aPtLst[n8aPtLst.Count - 2].X);
                            }
                        }

                        if (reLst[i].X > li0.EndPoint.X)
                        {
                            n8aPtLst.Add(reLst[reLst.Count - 1 - spancsLst.Count].C3D(-radius, radius));
                            if (n8aPtLst.Count > 1)
                            {
                                n8aLst.Add(n8aPtLst[n8aPtLst.Count - 1].X - n8aPtLst[n8aPtLst.Count - 2].X);
                            }
                        }
                    }
                }
                div = 0;
                for (int i = 0; i < reLLst.Count; i++)
                {
                    if (reLLst[i].Y <= li2.StartPoint.Y && reLLst[i].Y >= li2.EndPoint.Y)
                    {
                        ptLLst.Add(new Point3d(pt1.X - radius, reLLst[i].Y, 0));
                        ptRLst.Add(new Point3d(pt2.X + radius, reLLst[i].Y, 0));

                        if ((div) % 3 == 0 || div == spancmLst.Count - 2)
                        {
                            if (div == spancmLst.Count - 2)
                            {
                                int di = div % 3;
                                PLPloter.AddLine(db, reLLst[i + di].C2D(-radius, radius), reRLst[i + di].C2D(radius, radius), ref ext, "H钢筋");
                                n8PtLst.Add(reLLst[i + di].C3D(-radius, radius));
                                if (n8PtLst.Count > 1)
                                {
                                    n8Lst.Add(n8PtLst[n8PtLst.Count - 1].Y - n8PtLst[n8PtLst.Count - 2].Y);
                                }
                            }
                            else
                            {
                                PLPloter.AddLine(db, reLLst[i].C2D(-radius, -radius), reRLst[i].C2D(radius, -radius), ref ext, "H钢筋");
                                n8PtLst.Add(reLLst[i].C3D(-radius, -radius));
                                if (n8PtLst.Count > 1)
                                {
                                    n8Lst.Add(n8PtLst[n8PtLst.Count - 1].Y - n8PtLst[n8PtLst.Count - 2].Y);
                                }
                            }
                        }
                        div++;
                    }
                    else
                    {
                        if (reLLst[i].Y < li2.EndPoint.Y)
                        {
                            n8PtLst.Add(reLLst[spancsLst.Count].C3D(-radius, radius));
                            if (n8Lst.Count > 1)
                            {
                                n8Lst.Add(n8PtLst[n8PtLst.Count - 1].Y - n8PtLst[n8PtLst.Count - 2].Y);
                            }
                        }

                        if (reLLst[i].Y > li2.StartPoint.Y)
                        {
                            n8PtLst.Add(reLLst[reLLst.Count - 1 - spancsLst.Count].C3D(-radius, -radius));
                            if (n8Lst.Count > 1)
                            {
                                n8Lst.Add(n8PtLst[n8PtLst.Count - 1].Y - n8PtLst[n8PtLst.Count - 2].Y);
                            }
                        }
                    }
                }

                n8Lst.Reverse();
                RebarPLPloter.CreateLineArrowDBNew(db, ref ext, n8PtLst[n8PtLst.Count - 1].C3D(topThickness * 0.45), ArrowDirection.North, n8Lst, new List<double>(), "8", scale, true, 10, 0);
                RebarPLPloter.CreateLineArrowDBNew(db, ref ext, n8aPtLst[0].C3D(0, -topThickness * 0.45), ArrowDirection.West, new List<double>(), n8aLst, "8a", scale, true, 0, 4 * scale);
                N8N = n8PtLst.Count;
                N8aN = n8aPtLst.Count;
                LineSegment2d li1 = PL1.GetLineSegment2dAt(1);

                Line l1 = new Line(li1.StartPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li1.EndPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

                double lenLine = l1.Length;
                Point3d p1 = MathExtensions.GetIntersection(l1, line1);
                Point3d p2 = MathExtensions.GetIntersection(l1, line2);
                PLPloter.AddLine(db, p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine / 3).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                Point3d pp2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine * 2 / 3).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptRTLst.Add(pp1);
                ptRTLst.Add(pp2);

                LineSegment2d li3 = PL1.GetLineSegment2dAt(3);
                Line l3 = new Line(li3.StartPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li3.EndPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

                p1 = MathExtensions.GetIntersection(l3, line2);
                p2 = MathExtensions.GetIntersection(l3, line3);
                PLPloter.AddLine(db, p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                pp1 = MathExtensions.GetPointOnTheLine(l3.StartPoint.C2D(), l3.EndPoint.C2D(), lenLine / 3).C3D(radius * Math.Cos(ang), -radius * Math.Sin(ang));
                pp2 = MathExtensions.GetPointOnTheLine(l3.StartPoint.C2D(), l3.EndPoint.C2D(), lenLine * 2 / 3).C3D(radius * Math.Cos(ang), -radius * Math.Sin(ang));
                ptRBLst.Add(pp1);
                ptRBLst.Add(pp2);

                LineSegment2d li5 = PL1.GetLineSegment2dAt(5);
                Line l5 = new Line(li5.StartPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li5.EndPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

                p1 = MathExtensions.GetIntersection(l5, line3);
                p2 = MathExtensions.GetIntersection(l5, line4);
                PLPloter.AddLine(db, p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                pp1 = MathExtensions.GetPointOnTheLine(l5.StartPoint.C2D(), l5.EndPoint.C2D(), lenLine / 3).C3D(-radius * Math.Cos(ang), -radius * Math.Sin(ang));
                pp2 = MathExtensions.GetPointOnTheLine(l5.StartPoint.C2D(), l5.EndPoint.C2D(), lenLine * 2 / 3).C3D(-radius * Math.Cos(ang), -radius * Math.Sin(ang));
                ptLBLst.Add(pp1);
                ptLBLst.Add(pp2);

                LineSegment2d li7 = PL1.GetLineSegment2dAt(7);
                Line l7 = new Line(li7.StartPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li7.EndPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

                p1 = MathExtensions.GetIntersection(l7, line1);
                p2 = MathExtensions.GetIntersection(l7, line4);
                PLPloter.AddLine(db, p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                Line lineN3a = new Line(p1, p2);
                lenN3a = Math.Round(lineN3a.Length, 1);
                pp1 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine / 3).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                pp2 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine * 2 / 3).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptLTLst.Add(pp1);
                ptLTLst.Add(pp2);
                Point3d ptN5 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine / 2).C3D();
                RebarDimPloter.CreateHookLineMark(db, ref ext, ptN5, "3b", 3 * scale, scale, 315);
                tr.Commit();
            }
            //10
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptTLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptBLst, scale, 0, false);

            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRLst, scale, 0, false);

            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRTLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRBLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLTLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLBLst, scale, 0, false);

            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_LEFT, ptRLst, "2a", 1, 0, scale, false, 3 * scale);
            SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_BOTTOM, ptBLst, "2b", ptBLst.Count / 15, ptBLst.Count / 10, scale, false, 3.5 * scale);
            SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_TOP, reBLst, "1", ptBLst.Count / 15, ptBLst.Count / 10, scale, false, 4.5 * scale);

            //SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_RIGHT, reRLst, "1b", reRLst.Count / 4, reRLst.Count / 4, scale, false, 4.5 * scale);

            //List<Point3d> listN1T = new List<Point3d>();
            //List<Point3d> listN1M = new List<Point3d>();
            //List<Point3d> listN1B = new List<Point3d>();
            //List<Point3d> listN2T = new List<Point3d>();
            //List<Point3d> listN2B = new List<Point3d>();
            //for (int i = 0; i < reRLst.Count; i++)
            //{
            //    if (i <= spancslLst.Count)
            //        listN1T.Add(reRLst[i]);
            //    else if (i > spancslLst.Count && i <= spancslLst.Count + spancmlLst.Count + 1)
            //        listN1M.Add(reRLst[i]);
            //    else
            //        listN1B.Add(reRLst[i]);
            //}
            List<Point3d> listN1T = new List<Point3d>();
            List<Point3d> listN1M = new List<Point3d>();
            List<Point3d> listN1B = new List<Point3d>();
            //List<Point3d> listN2T = new List<Point3d>();
            //List<Point3d> listN2B = new List<Point3d>();
            //for (int i = 0; i < reRLst.Count; i++)
            for (int i = 1; i < reRLst.Count - 1; i++)
            {
                if (i <= spancslLst.Count)
                    listN1T.Add(reRLst[i]);
                else if (i > spancslLst.Count && i < spancslLst.Count + spancmlLst.Count)
                    listN1M.Add(reRLst[i]);
                else
                    listN1B.Add(reRLst[i]);
            }

            SteelBarPileCap.CreateLineList(db, ref ext, listN1T, eDirection.E_RIGHT, 5 * scale, "H细线");
            Point3d pttxt = GeTools.MidPoint(listN1T[0], listN1T[listN1T.Count - 1]);
            TextPloter.AddDBText(db, pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "1a", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            SteelBarPileCap.CreateLineList(db, ref ext, listN1M, eDirection.E_RIGHT, 5 * scale, "H细线");
            pttxt = GeTools.MidPoint(listN1M[0], listN1M[listN1M.Count - 1]);
            TextPloter.AddDBText(db, pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "1b", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            SteelBarPileCap.CreateLineList(db, ref ext, listN1B, eDirection.E_RIGHT, 5 * scale, "H细线");
            pttxt = GeTools.MidPoint(listN1B[0], listN1B[listN1B.Count - 1]);
            TextPloter.AddDBText(db, pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "1a", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);


            #endregion



            #region  箍筋
            //List<double> lstLenWSList = new List<double>();
            //List<double> lstLenLSList = new List<double>();
            //int num = spancmLst.Count / pierPara.pierRebar.stirrup_count;
            //if (spancmLst.Count % pierPara.pierRebar.stirrup_count >= pierPara.pierRebar.stirrup_count * 0.25)
            //{
            //    num = num + 1;
            //}
            //List<double> lst = new List<double>();
            //int neA = (int)((pierPara.pierRebar.stirrup_count * num - spancmLst.Count) * 0.5);
            //if (neA > 0)
            //{
            //    for (int i = neA; i > 0; i--)
            //    {
            //        lst.Add(spancaLst[spancaLst.Count - neA]);
            //    }
            //    for (int i = 0; i < spancmLst.Count; i++)
            //    {
            //        lst.Add(spancmLst[spancmLst.Count - neA]);
            //    }
            //    for (int i = neA; i > 0; i--)
            //    {
            //        lst.Add(spancaLst[spancaLst.Count - neA]);
            //    }
            //}
            //else
            //{
            //    lst = spancmLst;
            //    if (lst.Count % pierPara.pierRebar.stirrup_count != 0)
            //    {
            //        for (int i = lst.Count; i < num * pierPara.pierRebar.stirrup_count; i++)
            //        {
            //            lst.Add(lst[0]);
            //        }
            //    }
            //}
            //double wlen = lst.Sum() + 2 * radius;
            //double les = 0;
            //double les0 = 0;
            //Point2d ptS = pt.C2D(-wlen * 0.5, -avgl + radius);
            //Point2d ptBS = pt.C2D(-wlen * 0.5, -L + avgl - radius + sl + radius * 2);
            //for (int i = 0; i < lst.Count; i++)
            //{
            //    les0 += lst[i];
            //    les += lst[i];
            //    if ((i + 1) % pierPara.pierRebar.stirrup_count == 0)
            //    {
            //        PLPloter.AddPloy4(ptS.C2D(les0 - les + les * 0.5 + radius), les * 0.5 + radius, les * 0.5 + radius, sl + radius * 2, ref ext, "H钢筋");
            //        PLPloter.AddPloy4(ptBS.C2D(les0 - les + les * 0.5 + radius), les * 0.5 + radius, les * 0.5 + radius, sl + radius * 2, ref ext, "H钢筋");
            //        lstLenWSList.Add(les);
            //        les = 0;
            //    }
            //}

            //int numl = spancmlLst.Count / pierPara.pierRebar.stirrup_count;
            ////if (spancmlLst.Count % pierPara.pierRebar.stirrup_count > pierPara.pierRebar.stirrup_count * 0.5)
            ////{
            ////    numl = numl + 1;
            ////}
            //List<double> lLst = new List<double>();
            //int neLA = (int)((pierPara.pierRebar.stirrup_count * numl - spancmlLst.Count) * 0.5);
            //if (neLA > 0)
            //{
            //    for (int i = neLA; i > 0; i--)
            //    {
            //        lLst.Add(spancslLst[spancslLst.Count - neLA]);
            //    }
            //    for (int i = 0; i < spancmlLst.Count; i++)
            //    {
            //        lLst.Add(spancmlLst[i]);
            //    }
            //    for (int i = neLA; i > 0; i--)
            //    {
            //        lLst.Add(spancslLst[spancslLst.Count - neLA]);
            //    }
            //}
            //else
            //{
            //    if (spancmlLst.Count > pierPara.pierRebar.stirrup_count * numl)
            //    {
            //        for (int i = 0; i < numl * pierPara.pierRebar.stirrup_count; i++)
            //        {
            //            lLst.Add(spancmlLst[i]);
            //        }
            //    }
            //    else
            //    {
            //        lLst = spancmlLst;
            //        if (lLst.Count % pierPara.pierRebar.stirrup_count != 0)
            //        {
            //            for (int i = lLst.Count; i < numl * pierPara.pierRebar.stirrup_count; i++)
            //            {
            //                lLst.Add(lst[0]);
            //            }
            //        }
            //    }
            //}
            //double wLlen = lLst.Sum();
            //les = 0;
            //les0 = 0;
            //Point2d ptS1 = pt.C2D(-pierPara.column.top_w * 0.5 + avg + sw * 0.5, -avgl - sl - pierPara.pierRebar.main_l_space);
            //Point2d ptBS1 = pt.C2D(pierPara.column.top_w * 0.5 - avg - sw * 0.5, -avgl - sl - pierPara.pierRebar.main_l_space);
            //int div = 0;
            //bool isAdd = false;
            //for (int i = 0; i < lLst.Count; i++)
            //{
            //    les0 += lLst[i];
            //    les += lLst[i];
            //    if (lLst.Count % pierPara.pierRebar.stirrup_count == 0)
            //    {
            //        if ((i + 1) % pierPara.pierRebar.stirrup_count == 0)
            //        {
            //            PLPloter.AddPloy4(ptS1.C2D(0, -(les0 - les - radius)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
            //            PLPloter.AddPloy4(ptBS1.C2D(0, -(les0 - les - radius)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
            //            lstLenLSList.Add(les);
            //            les = 0;
            //        }
            //    }               

            //}
            #endregion

            #region 实心段钢筋网

            #endregion

            List<double> lList = new List<double>();
            lList.Add(sl + radius * 2);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, pt.C3D(pierPara.column.top_w * 0.15 + 5, -L + avgl - radius), ArrowDirection.North, new List<double>(), new List<double>(), "3", scale, true, 5, 0);

            //lList = new List<double>();
            //lList.Add(sw + radius * 2);
            //RebarPLPloter.CreateLineArrowDBNew(db, ref ext, pt.C3D(pierPara.column.top_w * 0.5 - avg - sw - radius, -L * 0.3 - 5), ArrowDirection.West, new List<double>(), lList, "5", scale, true, 7, 0);

            //lList = new List<double>();
            //lList.Add(sw + radius * 2);
            //RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBS1.C3D(0, radius), ArrowDirection.North, lstLenLSList, new List<double>(), "5a", scale, false, 13, 0);

            //lList = new List<double>();
            //lList.Add(sw + radius * 2);
            //RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptS.C3D(0, -sl * 0.5), ArrowDirection.West, new List<double>(), lstLenWSList, "4a", scale, false, 18, 0);




        }



        public void PlotSectionFF(ref Database db, out Extents2d ext, Point2d insertPoint, double scale)
        {          
            scale = scale * extendscale;
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "F-F", "", scale);
            Point2d pt = insertPoint.C2D(0, -20 * scale);

            double W = pierPara.column.top_w;
            double L = pierPara.column.top_l;
            if (pierPara.column.slope_w > 0)
                W = W + 120;
            if (pierPara.column.slope_l > 0)
                L = L + 80;
            double BottomW = pierPara.column.top_l + pierPara.pier_height * 100 * pierPara.column.slope_l * 2;
            L = BottomW - 10;
            double lenW = Math.Round(spancwLst.Sum(), 1);
            double avg = Math.Round((pierPara.column.top_w - lenW) * 0.5, 1);
            double lenL = Math.Round(spanclLst.Sum(), 1);
            double avgl = Math.Round((pierPara.column.top_l - lenL) * 0.5, 1);


            string[] sizeOut = pierPara.column.out_section_ang.Split('*');
            string[] sizeInner = pierPara.column.inner_section_ang.Split('*');
            double outW = double.Parse(sizeOut[0]);
            double outL = double.Parse(sizeOut[1]);
            double innerW = double.Parse(sizeInner[0]);
            double innerL = double.Parse(sizeInner[1]);
            ObjectId pLId1 = PLPloter.CreatPoly8(db, pt.C2D(), ref ext, L, W, "H细线", outL, outW, outL, outW);

            ObjectId pLId2 = PLPloter.CreatPoly8(db, pt.C2D(0, -topThickness), ref ext, L - 2 * topThickness, W - 2 * topThickness, "H细线", innerW, innerL, innerW, innerL);

            ObjectId pLId3 = PLPloter.CreatPoly8(db, pt.C2D(0, -avg + radius), ref ext, L - avg * 2 + radius * 2, W - avg * 2 + radius * 2, "H钢筋", outL, outW, outL, outW);

            List<Point3d> reLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -avgl),
                    radius, spancwLst, scale, 0, out reLst, false);
            List<Point3d> reBLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
             radius, spancwLst, scale, 0, out reBLst, false);


            int changeNum = 0;
            int midNum = 0;
            List<Point2d> ptGGTLst = new List<Point2d>();
         
            RebarArrangement.ArrangePointBySpace(pt.C2D(-W * 0.5 + avg, -L + avgl), spancslLst, spancmlLst, lenL, BottomW - 2 * avg, out ptGGTLst, out changeNum, out midNum, pierPara.pierRebar.main_l_space);



            double vL = L - 2 * avg;
            List<double> vLst = new List<double>();
            List<double> vLst0 = new List<double>();
            //string dimC = (changeNum - 1) + "×C";
            //double spChange = (vL - lenL) / ((changeNum - 1) * 2);
            int addChange = 0;
            RebarArrangement.ArrangeSpanBySpace(spancslLst, spancmlLst, BottomW - 2 * avg, vL, out vLst0, pierPara.pierRebar.main_l_space);
            RebarArrangement.ArrangeSpanByMidSpace(spancslLst, spancmlLst, vLst0.Count, vL, out vLst,out addChange);
            
            List<Point3d> reLLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
            radius, vLst, scale, 0, out reLLst, false, false);
            List<Point3d> reRLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(W * 0.5 - avg, -L + avgl),
            radius, vLst, scale, 0, out reRLst, false, false);

            double sw = spancsLst.Sum();
            double sl = spancslLst.Sum();
            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg + sw + radius, -avgl + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + avgl - radius), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg - sw - radius, -avgl + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + avgl - radius), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -avgl - sl - radius), pt.C2D(W * 0.5 - avg + radius, -avgl - sl - radius), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + avgl + sl + radius), pt.C2D(W * 0.5 - avg + radius, -L + avgl + sl + radius), ref ext, "H钢筋");

            #region 标注
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), reLst[0], pt.C3D(0, 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            //DimPloter.DimRot(db, pt.C3D(pierPara.column.top_w * 0.5), reLst[reLst.Count - 1], pt.C3D(0, 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);          
            //DimPloter.DimRot(db, reLst[0], reLst[reLst.Count - 1], pt.C3D(0, 10 * scale), ref ext, 0, scale, dimWSideString + "+" + dimWMidString + "+" + dimWSideString, Unit.Centimeter, Unit.Centimeter);

            ////string v = avg + "+" + pierPara.pierRebar.main_w_thickness_layout + "+" + pierPara.pierRebar.main_w_angle_layout + "+" + pierPara.pierRebar.main_w_mid_layout + "+" + pierPara.pierRebar.main_w_angle_layout + "+" + pierPara.pierRebar.main_w_thickness_layout + "+" + avg;
            ////DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 10 * scale), ref ext, 0, scale, dimWString, Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 15 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);

            //string vl = (spancmlLst.Count()-2) + "×" + pierPara.pierRebar.main_l_space;

            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5, -L), reLLst[spancslLst.Count], pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale, avg.ToString()+"+"+ dimLLString, Unit.Centimeter, Unit.Centimeter,1);
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5, 0), reLLst[reLLst.Count-1 - spancslLst.Count], pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale, avg.ToString() + "+" + dimLLString, Unit.Centimeter, Unit.Centimeter,1);
            ////DimPloter.DimRot(db, reLLst[0], reLLst[changeNum], pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, dimLLString, Unit.Centimeter, Unit.Centimeter);
            ////DimPloter.DimRot(db, reLLst[reLLst.Count- changeNum - 1], reLLst[reLLst.Count - 1], pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, dimLLString, Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, reLLst[spancslLst.Count+changeNum], reLLst[reLLst.Count - 1-(spancslLst.Count+changeNum)], pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, vl, Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 15 * scale), ref ext, 90, scale, "Bdi", Unit.Centimeter, Unit.Centimeter);
            #endregion

            DimPloter.DimRotExtend(db, pt.C3D(-pierPara.column.top_w * 0.5), reLst[0], pt.C3D(0, 10 * scale), ref ext, 0, scale/extendscale, extendscale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRotExtend(db, pt.C3D(pierPara.column.top_w * 0.5), reLst[reLst.Count - 1], pt.C3D(0, 10 * scale), ref ext, 0, scale / extendscale, extendscale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRotExtend(db, reLst[0], reLst[reLst.Count - 1], pt.C3D(0, 10 * scale), ref ext, 0, scale / extendscale, extendscale, dimWSideString + "+" + dimWMidString + "+" + dimWSideString, Unit.Centimeter, Unit.Centimeter);

           
            DimPloter.DimRotExtend(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 15 * scale), ref ext, 0, scale / extendscale, extendscale, "", Unit.Centimeter, Unit.Centimeter);

            string vl = (spancmlLst.Count() - 2) + "×" + pierPara.pierRebar.main_l_space;

            DimPloter.DimRotExtend(db, pt.C3D(-pierPara.column.top_w * 0.5, -L), reLLst[spancslLst.Count], pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale / extendscale, extendscale, avg.ToString() + "+" + dimLLString, Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRotExtend(db, pt.C3D(-pierPara.column.top_w * 0.5, 0), reLLst[reLLst.Count - 1 - spancslLst.Count], pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale / extendscale, extendscale, avg.ToString() + "+" + dimLLString, Unit.Centimeter, Unit.Centimeter, 1);
          
            DimPloter.DimRotExtend(db, reLLst[spancslLst.Count + changeNum], reLLst[reLLst.Count - 1 - (spancslLst.Count + changeNum)], pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale / extendscale, extendscale, vl, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRotExtend(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 15 * scale), ref ext, 90, scale / extendscale, extendscale, "Bdi", Unit.Centimeter, Unit.Centimeter);
           
            #region 内部点筋
            List<Point3d> ptTLst = new List<Point3d>();
            List<Point3d> ptBLst = new List<Point3d>();

            List<Point3d> ptLLst = new List<Point3d>();
            List<Point3d> ptRLst = new List<Point3d>();

            List<Point3d> ptLTLst = new List<Point3d>();
            List<Point3d> ptRTLst = new List<Point3d>();
            List<Point3d> ptLBLst = new List<Point3d>();
            List<Point3d> ptRBLst = new List<Point3d>();

            double ang = Math.Atan(innerW / innerL);
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                BlockTable blockTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
                LayerTable lt = tr.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable;
                BlockTableRecord modelSpace;
                modelSpace = tr.GetObject(blockTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
                Polyline PL1 = tr.GetObject(pLId2, OpenMode.ForRead) as Polyline;
                Polyline PL = tr.GetObject(pLId3, OpenMode.ForRead) as Polyline;
                LineSegment2d li = PL.GetLineSegment2dAt(0);
                Line line1 = PL.GetLineSegment2dAt(0).CLine();
                Line line2 = PL.GetLineSegment2dAt(2).CLine();
                Line line3 = PL.GetLineSegment2dAt(4).CLine();
                Line line4 = PL.GetLineSegment2dAt(6).CLine();

                LineSegment2d li0 = PL1.GetLineSegment2dAt(0);
                LineSegment2d li2 = PL1.GetLineSegment2dAt(2);

                int stIndex = 0;
                int endIndex = 0;
                int stlIndex = 0;
                int endlIndex = 0;
                Point2d pt1 = pt.C2D(-W * 0.5 + avg + sw + radius, -avgl + radius);
                Point2d pt2 = pt.C2D(W * 0.5 - avg - sw - radius, -L + avgl - radius);
                Point2d pt3 = pt.C2D(-W * 0.5 + avg - radius, -avgl - sl - radius);
                Point2d pt4 = pt.C2D(-W * 0.5 + avg - radius, -L + avgl + sl + radius);

                for (int i = 0; i < reLst.Count; i++)
                {
                    if (reLst[i].X >= li0.StartPoint.X && reLst[i].X <= li0.EndPoint.X)
                    {
                        ptTLst.Add(new Point3d(reLst[i].X, pt3.Y + radius, 0));
                        ptBLst.Add(new Point3d(reLst[i].X, pt4.Y - radius, 0));
                    }
                }

                for (int i = 0; i < reLLst.Count; i++)
                {
                    if (reLLst[i].Y <= li2.StartPoint.Y && reLLst[i].Y >= li2.EndPoint.Y)
                    {
                        ptLLst.Add(new Point3d(pt1.X - radius, reLLst[i].Y, 0));
                        ptRLst.Add(new Point3d(pt2.X + radius, reLLst[i].Y, 0));
                    }
                }

                LineSegment2d li1 = PL1.GetLineSegment2dAt(1);

                Line l1 = new Line(li1.StartPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li1.EndPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

                double lenLine = l1.Length;
                Point3d p1 = MathExtensions.GetIntersection(l1, line1);
                Point3d p2 = MathExtensions.GetIntersection(l1, line2);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine / 3).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                Point3d pp2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine * 2 / 3).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptRTLst.Add(pp1);
                ptRTLst.Add(pp2);

                LineSegment2d li3 = PL1.GetLineSegment2dAt(3);
                Line l3 = new Line(li3.StartPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li3.EndPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

                p1 = MathExtensions.GetIntersection(l3, line2);
                p2 = MathExtensions.GetIntersection(l3, line3);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                pp1 = MathExtensions.GetPointOnTheLine(l3.StartPoint.C2D(), l3.EndPoint.C2D(), lenLine / 3).C3D(radius * Math.Cos(ang), -radius * Math.Sin(ang));
                pp2 = MathExtensions.GetPointOnTheLine(l3.StartPoint.C2D(), l3.EndPoint.C2D(), lenLine * 2 / 3).C3D(radius * Math.Cos(ang), -radius * Math.Sin(ang));
                ptRBLst.Add(pp1);
                ptRBLst.Add(pp2);

                LineSegment2d li5 = PL1.GetLineSegment2dAt(5);
                Line l5 = new Line(li5.StartPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li5.EndPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

                p1 = MathExtensions.GetIntersection(l5, line3);
                p2 = MathExtensions.GetIntersection(l5, line4);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                pp1 = MathExtensions.GetPointOnTheLine(l5.StartPoint.C2D(), l5.EndPoint.C2D(), lenLine / 3).C3D(-radius * Math.Cos(ang), -radius * Math.Sin(ang));
                pp2 = MathExtensions.GetPointOnTheLine(l5.StartPoint.C2D(), l5.EndPoint.C2D(), lenLine * 2 / 3).C3D(-radius * Math.Cos(ang), -radius * Math.Sin(ang));
                ptLBLst.Add(pp1);
                ptLBLst.Add(pp2);

                LineSegment2d li7 = PL1.GetLineSegment2dAt(7);
                Line l7 = new Line(li7.StartPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li7.EndPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

                p1 = MathExtensions.GetIntersection(l7, line1);
                p2 = MathExtensions.GetIntersection(l7, line4);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                pp1 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine / 3).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                pp2 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine * 2 / 3).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptLTLst.Add(pp1);
                ptLTLst.Add(pp2);

                Point3d ptN5 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine / 2).C3D();
                RebarDimPloter.CreateHookLineMark(db, ref ext, ptN5, "3b", 3 * scale, scale, 315);
                tr.Commit();
            }

            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptTLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptBLst, scale, 0, false);

            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRLst, scale, 0, false);

            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRTLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRBLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLTLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLBLst, scale, 0, false);

            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_LEFT, ptRLst, "2a", 1, 0, scale, false, 3 * scale);
            SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_BOTTOM, ptBLst, "2b", ptBLst.Count / 15, ptBLst.Count / 10, scale, false, 3.5 * scale);
            //SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_BOTTOM, ptBLst, "3", ptBLst.Count / 10, ptBLst.Count / 10, scale, false, 4.5 * scale);
            SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_TOP, reBLst, "1", ptBLst.Count / 10, ptBLst.Count / 10, scale, false, 4.5 * scale);

            List<Point3d> listN1T = new List<Point3d>();
            List<Point3d> listN1M = new List<Point3d>();
            List<Point3d> listN1B = new List<Point3d>();
            List<Point3d> listN2T = new List<Point3d>();
            List<Point3d> listN2B = new List<Point3d>();
            //for (int i = 0; i < reRLst.Count; i++)
            for (int i = 1; i < reRLst.Count - 1; i++)
            {
                //if (i <= spancslLst.Count)
                //    listN1T.Add(reRLst[i]);
                //else if (i > spancslLst.Count && i <= spancslLst.Count + changeNum - 1)
                //    listN2T.Add(reRLst[i]);
                //else if (i > spancslLst.Count + changeNum - 1 && i < spancslLst.Count + changeNum - 1 + spancmlLst.Count)
                //    listN1M.Add(reRLst[i]);
                //else if (i >= spancslLst.Count + changeNum - 1 + spancmlLst.Count && i < reRLst.Count - 1 - spancslLst.Count)
                //    listN2B.Add(reRLst[i]);
                //else
                //    listN1B.Add(reRLst[i]);
                if (i <= spancslLst.Count)
                    listN1T.Add(reRLst[i]);
                else if (i > spancslLst.Count && i <= spancslLst.Count + changeNum)
                    listN2T.Add(reRLst[i]);            
                else if (i >= reRLst.Count - 1 - spancslLst.Count - changeNum  && i < reRLst.Count - 1 - spancslLst.Count)
                    listN2B.Add(reRLst[i]);
                else if (i >= reRLst.Count - 1 - spancslLst.Count)
                    listN1B.Add(reRLst[i]);
                else 
                    listN1M.Add(reRLst[i]);
            } 

            SteelBarPileCap.CreateLineList(db, ref ext, listN1T, eDirection.E_RIGHT, 5 * scale, "H细线");
            Point3d pttxt = GeTools.MidPoint(listN1T[0], listN1T[listN1T.Count - 1]);
            TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "1a", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            SteelBarPileCap.CreateLineList(db, ref ext, listN1M, eDirection.E_RIGHT, 5 * scale, "H细线");
            pttxt = GeTools.MidPoint(listN1M[0], listN1M[listN1M.Count - 1]);
            TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "1b", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            SteelBarPileCap.CreateLineList(db, ref ext, listN1B, eDirection.E_RIGHT, 5 * scale, "H细线");
            pttxt = GeTools.MidPoint(listN1B[0], listN1B[listN1B.Count - 1]);
            TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "1a", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);

            if (changeNum > 0)
            {
                SteelBarPileCap.CreateLineList(db, ref ext, listN2T, eDirection.E_RIGHT, 5 * scale, "H细线");
                pttxt = GeTools.MidPoint(listN2T[0], listN2T[listN2T.Count - 1]);
                TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "2", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
                SteelBarPileCap.CreateLineList(db, ref ext, listN2B, eDirection.E_RIGHT, 5 * scale, "H细线");
                pttxt = GeTools.MidPoint(listN2B[0], listN2B[listN2B.Count - 1]);
                TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "2", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            }
            #endregion

            #region  箍筋
            List<double> lstLenWSList = new List<double>();
            List<double> lstLenLSList = new List<double>();
            List<double> lstLenLSN5bList = new List<double>();
            int num = spancmLst.Count / pierPara.pierRebar.stirrup_count+1;
          
            List<double> lst = new List<double>();
            int neA = (int)((pierPara.pierRebar.stirrup_count * num - spancmLst.Count) * 0.5);
            if (neA > 0)
            {
                for (int i = neA; i > 0; i--)
                {
                    lst.Add(spancaLst[spancaLst.Count - neA]);
                }
                for (int i = 0; i < spancmLst.Count; i++)
                {
                    lst.Add(spancmLst[spancmLst.Count - neA]);
                }
                for (int i = neA; i > 0; i--)
                {
                    lst.Add(spancaLst[spancaLst.Count - neA]);
                }
            }
            else
            {
                lst = spancmLst;
                if (lst.Count % pierPara.pierRebar.stirrup_count != 0)
                {
                    for (int i = lst.Count; i < num * pierPara.pierRebar.stirrup_count; i++)
                    {
                        lst.Add(lst[0]);
                    }
                }
            }
            double wlen = lst.Sum() + 2 * radius;
            double les = 0;
            double les0 = 0;
            //Point2d ptS = pt.C2D(-wlen * 0.5, -avgl + radius);
            //Point2d ptBS = pt.C2D(-wlen * 0.5, -L + avgl - radius + sl + radius * 2);
            int start = (reLst.Count - pierPara.pierRebar.stirrup_count * num) / 2;
            Point2d ptS = reLst[start].C2D(-radius, radius);
            Point2d ptBS = reBLst[start].C2D(-radius, - radius );
            List<Point2d> ptN4a = new List<Point2d>();
            int numS = 0;
            for (int i = 0; i < lst.Count; i++)
            {
                les0 += lst[i];
                les += lst[i];
                if ((i + 1) % pierPara.pierRebar.stirrup_count == 0||i== lst.Count-1)
                {
                    numS++;
                    if (numS % 2 != 0 || numS <= num || i== lst.Count-1)
                    {
                        PLPloter.AddPloy4(db, ptS.C2D(les0 - les + les * 0.5 + radius), les * 0.5 + radius, les * 0.5 + radius, sl + radius * 2, ref ext, "H钢筋");
                        PLPloter.AddPloy4(db, ptBS.C2D(les0 - les + les * 0.5 + radius, sl + radius * 2), les * 0.5 + radius, les * 0.5 + radius, sl + radius * 2, ref ext, "H钢筋");
                        //lstLenWSList.Add(les);
                        if (i == lst.Count - 1)
                        {
                            if(numS % 2 != 0)
                              ptN4a.Add(ptS.C2D(les0 - les));
                        }
                        else
                            ptN4a.Add(ptS.C2D(les0 - les));
                    }
                    les = 0;
                }
            }
            for(int i=0;i< ptN4a.Count;i++)
            {
                if (i > 0)
                    lstLenWSList.Add(ptN4a[i].X - ptN4a[i - 1].X);
            }
            N4a = lstLenWSList.Count();
            int numl = spancmlLst.Count / pierPara.pierRebar.stirrup_count;
            //if (spancmlLst.Count % pierPara.pierRebar.stirrup_count > pierPara.pierRebar.stirrup_count * 0.5)
            //{
            //    numl = numl + 1;
            //}
            List<double> lLst = new List<double>();
            int neLA = (int)((pierPara.pierRebar.stirrup_count * numl - spancmlLst.Count) * 0.5);
            //if (neLA > 0)
            //{
              
            //    for (int i = neLA; i > 0; i--)
            //    {
            //        lLst.Add(spancslLst[spancslLst.Count - neLA]);
            //    }
            //    for (int i = 0; i < spancmlLst.Count; i++)
            //    {
            //        lLst.Add(spancmlLst[i]);
            //    }
            //    for (int i = neLA; i > 0; i--)
            //    {
            //        lLst.Add(spancslLst[spancslLst.Count - neLA]);
            //    }
            //}
            //else
            //{
            //    if (spancmlLst.Count > pierPara.pierRebar.stirrup_count * numl)
            //    {
            //        for (int i = (spancmlLst.Count- numl * pierPara.pierRebar.stirrup_count)/2; i < numl * pierPara.pierRebar.stirrup_count; i++)
            //        {
            //            lLst.Add(spancmlLst[i]); 
            //        }
            //    }
            //    else
            //    {
            //        lLst = spancmlLst;
            //        if (lLst.Count % pierPara.pierRebar.stirrup_count != 0)
            //        {
            //            for (int i = lLst.Count; i < numl * pierPara.pierRebar.stirrup_count; i++)
            //            {
            //                lLst.Add(lst[0]);
            //            }
            //        }
            //    }
            //}
            

            double wLlen = lLst.Sum();
            les = 0;
            les0 = 0;
            numS = 0;
            start = (reLLst.Count - pierPara.pierRebar.stirrup_count * numl) / 2;
            for(int i= start-1;i< start+ pierPara.pierRebar.stirrup_count * numl;i++)
            {
                lLst.Add(vLst[i]);
            }
          
            //Point2d ptS1 = pt.C2D(-pierPara.column.top_w * 0.5 + avg + sw * 0.5, -avgl - sl - (vL - lenL) * 0.5);
            //Point2d ptBS1 = pt.C2D(pierPara.column.top_w * 0.5 - avg - sw * 0.5, -avgl - sl - (vL - lenL) * 0.5);

            Point2d ptS1 = reLLst[reLLst.Count-start].C2D(-radius, 0);
            Point2d ptBS1 = reRLst[reRLst.Count - start].C2D(-radius, 0);
            List<Point2d> ptN5b = new List<Point2d>();
            if (addChange >= pierPara.pierRebar.stirrup_count * 1.5)
            {
                int N = (int)(addChange - pierPara.pierRebar.stirrup_count * 0.25) / pierPara.pierRebar.stirrup_count;
                for (int i = 1; i <= N; i++)
                {
                    Point2d ptSL = reLLst[reLLst.Count - start+ pierPara.pierRebar.stirrup_count*i].C2D(-radius, 0);
                    PLPloter.AddLine(db, ptSL.C2D(0, radius), ptSL.C2D(sw+ radius*2, radius), ref ext, "H钢筋");
                    ptN5b.Add(ptSL.C2D(sw*0.5, radius));
                    Point2d ptSR = reRLst[reRLst.Count - start + pierPara.pierRebar.stirrup_count * i].C2D(-radius, 0);
                    PLPloter.AddLine(db, ptSR.C2D(0, radius), ptSR.C2D(-sw - radius * 2, radius), ref ext, "H钢筋");              

                    ptSL = reLLst[reLLst.Count - start- pierPara.pierRebar.stirrup_count* numl - pierPara.pierRebar.stirrup_count * i].C2D(-radius, 0);
                    PLPloter.AddLine(db, ptSL.C2D(0, -radius), ptSL.C2D(sw + radius * 2, -radius), ref ext, "H钢筋");
                    ptN5b.Add(ptSL.C2D(sw * 0.5, -radius));
                    ptSR = reRLst[reRLst.Count - start - pierPara.pierRebar.stirrup_count * numl - pierPara.pierRebar.stirrup_count * i].C2D(-radius, 0);
                    PLPloter.AddLine(db, ptSR.C2D(0, -radius), ptSR.C2D(-sw - radius * 2, - radius), ref ext, "H钢筋");
                }
            }
            if(ptN5b.Count>0)
            {
                ptN5b.Sort((x, y) => y.Y.CompareTo(x.Y));
            }
            for (int i = 0; i < ptN5b.Count; i++)
            {
                if (i > 0)
                    lstLenLSN5bList.Add(Math.Abs(ptN5b[i].Y - ptN5b[i - 1].Y));
            }
            N5b = ptN5b.Count * 2;

            List<Point2d> ptN5a = new List<Point2d>();
            int div = 0;
            bool isAdd = false;
            for (int i = 0; i < lLst.Count; i++)
            {
                les0 += lLst[i];
                les += lLst[i];
                if ((i + 1) % pierPara.pierRebar.stirrup_count == 0 )
                {
                    numS++;
                    //if (numS % 2 != 0 || numS <= 2 || i == lLst.Count - 1)
                    //{
                        //if (i == lLst.Count - 1)
                        //{
                        //    PLPloter.AddPloy4(ptS1.C2D(0, -(les0 - les - radius)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                        //    PLPloter.AddPloy4(ptBS1.C2D(0, -(les0 - les - radius)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                        //    //lstLenLSList.Add(les);
                        //    ptN5a.Add(ptS1.C2D(0, -(les0 - les - radius)));
                        //    les = 0;
                        //}
                        //else
                        //{

                        PLPloter.AddPloy4(db, ptS1.C2D(sw * 0.5 + radius, -les0 + les + radius), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                        PLPloter.AddPloy4(db, ptBS1.C2D(-(sw * 0.5) + radius, -les0 + les + radius), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");

                        //lstLenLSList.Add(les); 
                        //if (i == lLst.Count - 1)
                        //{
                        //    if (numS % 2 != 0)
                        //        ptN5a.Add(ptS1.C2D(0, -(les0 - les) + radius));
                        //}
                        //else
                            ptN5a.Add(ptS1.C2D(0, -les0 + les + radius));
                        les = 0;
                        //} 
                    //}
                }

            }
            for (int i = 0; i < ptN5a.Count; i++)
            {
                if (i > 0)
                    lstLenLSList.Add(Math.Abs(ptN5a[i].Y - ptN5a[i - 1].Y));
            }
            N5a = lstLenLSList.Count();
            #endregion

            #region 180°弯钩
            List<double> l180List = new List<double>();
            List<Point2d> lTPtList = new List<Point2d>();
            List<Point2d> lBPtList = new List<Point2d>();
            //for (int i = 0; i < pierPara.pierRebar.main_l_change_num / 2; i++)
            //{
            //    if (i % 2 == 1)
            //    {
            //        if (pierPara.pierRebar.main_l_change_num / 2 % 2 != 0)
            //        {
            //            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -(avgl + sl + (i + 1) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -(avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -(avgl + sl + (i + 1) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -(avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //            lTPtList.Add(pt.C2D(-W * 0.5 + avg - radius + sw * 0.5, -(avgl + sl + (i + 1) * spChange) + radius));
            //            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + (avgl + sl + (i + 1) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + (avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + (avgl + sl + (i + 1) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + (avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //            lBPtList.Add(pt.C2D(-W * 0.5 + avg - radius + sw * 0.5, -L + (avgl + sl + (i + 1) * spChange) + radius));

            //            PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -(avgl + sl + (i + 1) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -(avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //            PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -(avgl + sl + (i + 1) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -(avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //            PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -L + (avgl + sl + (i + 1) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + (avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //            PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -L + (avgl + sl + (i + 1) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + (avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //            //if (i!=1)
            //            l180List.Add(2 * spChange);
            //        }
            //        else
            //        {
            //            if (i != pierPara.pierRebar.main_l_change_num / 2 - 1)
            //            {
            //                PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -(avgl + sl + (i + 1) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -(avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //                PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -(avgl + sl + (i + 1) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -(avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //                lTPtList.Add(pt.C2D(-W * 0.5 + avg - radius + sw * 0.5, -(avgl + sl + (i + 1) * spChange) + radius));
            //                PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + (avgl + sl + (i + 1) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + (avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //                PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + (avgl + sl + (i + 1) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + (avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //                lBPtList.Add(pt.C2D(-W * 0.5 + avg - radius + sw * 0.5, -L + (avgl + sl + (i + 1) * spChange) + radius));

            //                PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -(avgl + sl + (i + 1) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -(avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //                PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -(avgl + sl + (i + 1) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -(avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //                PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -L + (avgl + sl + (i + 1) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + (avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //                PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -L + (avgl + sl + (i + 1) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + (avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //                //if (i != 1)
            //                l180List.Add(2 * spChange);
            //            }
            //        }
            //    }
            //    //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg-radius, -(avgl+sl + (pierPara.pierRebar.main_l_change_num/3)*spChange) + radius), pt.C2D(-W * 0.5 + avg+sw+radius, -(avgl + sl + (pierPara.pierRebar.main_l_change_num / 3) * spChange) + radius), ref ext, "H钢筋");
            //    //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -(avgl + sl + (pierPara.pierRebar.main_l_change_num*2 / 3) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -(avgl + sl + (pierPara.pierRebar.main_l_change_num * 2 / 3) * spChange) + radius), ref ext, "H钢筋");

            //    //PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -(avgl + sl + (pierPara.pierRebar.main_l_change_num / 3) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw -radius, -(avgl + sl + (pierPara.pierRebar.main_l_change_num / 3) * spChange) + radius), ref ext, "H钢筋");
            //    //PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -(avgl + sl + (pierPara.pierRebar.main_l_change_num * 2 / 3) * spChange) + radius), pt.C2D(W * 0.5 -avg - sw - radius, -(avgl + sl + (pierPara.pierRebar.main_l_change_num * 2 / 3) * spChange) + radius), ref ext, "H钢筋");

            //    //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + (avgl + sl + (pierPara.pierRebar.main_l_change_num / 3) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + (avgl + sl + (pierPara.pierRebar.main_l_change_num / 3) * spChange) + radius), ref ext, "H钢筋");
            //    //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + (avgl + sl + (pierPara.pierRebar.main_l_change_num * 2 / 3) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + (avgl + sl + (pierPara.pierRebar.main_l_change_num * 2 / 3) * spChange) + radius), ref ext, "H钢筋");

            //    //PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -L + (avgl + sl + (pierPara.pierRebar.main_l_change_num / 3) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + (avgl + sl + (pierPara.pierRebar.main_l_change_num / 3) * spChange) + radius), ref ext, "H钢筋");
            //    //PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -L + (avgl + sl + (pierPara.pierRebar.main_l_change_num * 2 / 3) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + (avgl + sl + (pierPara.pierRebar.main_l_change_num * 2 / 3) * spChange) + radius), ref ext, "H钢筋");

            //}
            #endregion
            List<double> lList = new List<double>();
            lList.Add(sl + radius * 2);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, pt.C3D(pierPara.column.top_w * 0.1 + 5, -L + avgl + sl + radius), ArrowDirection.North, lList, new List<double>(), "4", scale, true, 5, 0);

            lList = new List<double>();
            lList.Add(sw + radius * 2);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, pt.C3D(pierPara.column.top_w * 0.5 - avg - sw - radius, -L * 0.45 - 5), ArrowDirection.West, new List<double>(), lList, "5", scale, true, 7, 0);

            lList = new List<double>();
            lList.Add(sw + radius * 2);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBS1.C3D(-sw * 0.5, radius), ArrowDirection.North, lstLenLSList, new List<double>(), "5a", scale, true, L/18, 0 * scale);

            if (lstLenLSN5bList.Count > 0)
            {
                lList = new List<double>();
                lList.Add(sw + radius * 2);
                RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptN5b[0].C3D(), ArrowDirection.North, lstLenLSN5bList, new List<double>(), "5b", scale, true, L / 25, 0 * scale);
            }

            lList = new List<double>();
            lList.Add(sw + radius * 2);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptS.C3D(0, -sl * 0.5), ArrowDirection.West, new List<double>(), lstLenWSList, "4a", scale, false, 0, 4*scale);

            //if (l180List.Count > 0)
            //{
            //    RebarPLPloter.CreateLineArrowDBNew(db, ref ext, lTPtList[0].C3D(0, 2 * spChange), ArrowDirection.South, l180List, new List<double>(), "5b", scale, false, 6, 0);
            //    RebarPLPloter.CreateLineArrowDBNew(db, ref ext, lBPtList[lBPtList.Count - 1].C3D(), ArrowDirection.North, l180List, new List<double>(), "5b", scale, false, 10, 0 * scale);
            //}
        }

        public void PlotSectionGG(ref Database db, out Extents2d ext, Point2d insertPoint, double scale)
        {           
            scale = scale * extendscale;
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "G-G", "", scale);
            Point2d pt = insertPoint.C2D(0, -20 * scale);

            double W = pierPara.column.top_w;
            double L = pierPara.column.top_l;
            if (pierPara.column.slope_w > 0)
                W = W + 120;
            if (pierPara.column.slope_l > 0)
                L = L + 120;
            double BottomW = pierPara.column.top_l + pierPara.pier_height * 100 * pierPara.column.slope_l * 2;
            L = BottomW;
            double lenW = Math.Round(spancwLst.Sum(), 1);
            double avg =  Math.Round((pierPara.column.top_w - lenW) * 0.5, 1);
            double lenL = Math.Round(spanclLst.Sum(), 1);
            double avgl = Math.Round((pierPara.column.top_l - lenL) * 0.5, 1);


            string[] sizeOut = pierPara.column.out_section_ang.Split('*');
            string[] sizeInner = pierPara.column.inner_section_ang.Split('*');
            double outW = double.Parse(sizeOut[0]);
            double outL = double.Parse(sizeOut[1]);
            double innerW = double.Parse(sizeInner[0]);
            double innerL = double.Parse(sizeInner[1]);
            ObjectId pLId1 = PLPloter.CreatPoly8(db, pt.C2D(), ref ext, L, W, "H细线", outL, outW, outL, outW);

            Polyline pLId2 = PLPloter.CreatPoly8Polyline(db, pt.C2D(0, -topThickness), ref ext, L - 2 * topThickness, W - 2 * topThickness, "H细线", innerW, innerL, innerW, innerL);

            ObjectId pLId3 = PLPloter.CreatPoly8(db, pt.C2D(0, -avg + radius), ref ext, L - avg * 2 + radius * 2, W - avg * 2 + radius * 2, "H钢筋", outL, outW, outL, outW);

            List<Point3d> reLst = new List<Point3d>();

            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -avgl),
                    radius, spancwLst, scale, 0, out reLst, false);
            List<Point3d> reBLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
             radius, spancwLst, scale, 0, out reBLst, false);
            List<Point3d> reTeLst = new List<Point3d>();
            List<Point3d> reTeBLst = new List<Point3d>();
            if (pierPara.pierRebar.is_out_double&& pierPara.pierRebar.tendon_length>0)
            {
                double diaN1 = (GeneralRebar.outerDiaNew[pierPara.pierRebar.main_reinforcement_diameter] * 0.1);
             

                SteelBarPileCap.CreateDoubleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -avgl),
                        radius, diaN1,spancsLst.Count,spancwLst, scale, 0, out reTeLst, false);
              
                SteelBarPileCap.CreateDoubleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
                 radius, diaN1, spancsLst.Count, spancwLst, scale, 0, out reTeBLst, true);
            }

            int changeNum = 0;
            int midNum = 0;
            List<Point2d> ptGGTLst = new List<Point2d>();
         
            RebarArrangement.ArrangePointBySpace(pt.C2D(-W * 0.5 + avg, -L + avgl), spancslLst, spancmlLst, lenL, BottomW - 2 * avg, out ptGGTLst, out changeNum, out midNum, pierPara.pierRebar.main_l_space);




            double vL = L - 2 * avg;
            List<double> vLst = new List<double>();
            //string dimC = pierPara.pierRebar.main_l_change_num + "×C";
            //double spChange = (vL - lenL) / (pierPara.pierRebar.main_l_change_num * 2);
            RebarArrangement.ArrangeSpanBySpace(spancslLst, spancmlLst, BottomW - 2 * avg, vL, out vLst, pierPara.pierRebar.main_l_space);
            List<Point3d> reLLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
            radius, vLst, scale, 0, out reLLst, false, false);
            List<Point3d> reRLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(W * 0.5 - avg, -L + avgl),
            radius, vLst, scale, 0, out reRLst, false, false);

            double sw = spancsLst.Sum();
            double sl = spancslLst.Sum();
            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg + sw + radius, -avgl + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + avgl - radius), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg - sw - radius, -avgl + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + avgl - radius), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -avgl - sl - radius), pt.C2D(W * 0.5 - avg + radius, -avgl - sl - radius), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + avgl + sl + radius), pt.C2D(W * 0.5 - avg + radius, -L + avgl + sl + radius), ref ext, "H钢筋");

            #region 标注
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), reLst[0], pt.C3D(0, 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            //DimPloter.DimRot(db, pt.C3D(pierPara.column.top_w * 0.5), reLst[reLst.Count - 1], pt.C3D(0, 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            //DimPloter.DimRot(db, reLst[0], reLst[reLst.Count - 1], pt.C3D(0, 10 * scale), ref ext, 0, scale, dimWSideString + "+" + dimWMidString + "+" + dimWSideString, Unit.Centimeter, Unit.Centimeter);
            ////string v = avg + "+" + pierPara.pierRebar.main_w_thickness_layout + "+" + pierPara.pierRebar.main_w_angle_layout + "+" + pierPara.pierRebar.main_w_mid_layout + "+" + pierPara.pierRebar.main_w_angle_layout + "+" + pierPara.pierRebar.main_w_thickness_layout + "+" + avg;
            ////DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 10 * scale), ref ext, 0, scale, dimWString, Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 15 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);

            ////string vl = avg + "+" + dimLLString + "+" + pierPara.pierRebar.main_l_change_num + "×C" + "+" + dimLMString + "+" + pierPara.pierRebar.main_l_change_num + "×C" + "+" + dimLRString + "+" + avg;
            //string vl = avg + "+" + dimLLString + "+" + "C" + "+n×" + pierPara.pierRebar.main_l_space + "+" + "C" + "+" + dimLRString + "+" + avg;
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5, 0), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, vl, Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale, "Bd1", Unit.Centimeter, Unit.Centimeter);
            #endregion

            DimPloter.DimRotExtend(db, pt.C3D(-pierPara.column.top_w * 0.5), reLst[0], pt.C3D(0, 10 * scale), ref ext, 0, scale/extendscale, extendscale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRotExtend(db, pt.C3D(pierPara.column.top_w * 0.5), reLst[reLst.Count - 1], pt.C3D(0, 10 * scale), ref ext, 0, scale / extendscale, extendscale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRotExtend(db, reLst[0], reLst[reLst.Count - 1], pt.C3D(0, 10 * scale), ref ext, 0, scale / extendscale, extendscale, dimWSideString + "+" + dimWMidString + "+" + dimWSideString, Unit.Centimeter, Unit.Centimeter);
          
            DimPloter.DimRotExtend(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 15 * scale), ref ext, 0, scale / extendscale, extendscale, "", Unit.Centimeter, Unit.Centimeter);
          
            string vl = avg + "+" + dimLLString + "+" + "C" + "+n×" + pierPara.pierRebar.main_l_space + "+" + "C" + "+" + dimLRString + "+" + avg;
            DimPloter.DimRotExtend(db, pt.C3D(-pierPara.column.top_w * 0.5, 0), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale / extendscale, extendscale, vl, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRotExtend(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale / extendscale, extendscale, "Bd1", Unit.Centimeter, Unit.Centimeter);
            
            #region 内部点筋
            List<Point3d> ptTLst = new List<Point3d>();
            List<Point3d> ptBLst = new List<Point3d>();

            List<Point3d> ptLLst = new List<Point3d>();
            List<Point3d> ptRLst = new List<Point3d>();

            List<Point3d> ptLTLst = new List<Point3d>();
            List<Point3d> ptRTLst = new List<Point3d>();
            List<Point3d> ptLBLst = new List<Point3d>();
            List<Point3d> ptRBLst = new List<Point3d>();

            double ang = Math.Atan(innerW / innerL);
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                BlockTable blockTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
                LayerTable lt = tr.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable;
                BlockTableRecord modelSpace;
                modelSpace = tr.GetObject(blockTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
                Polyline PL1 = pLId2;// tr.GetObject(pLId2, OpenMode.ForRead) as Polyline;
                Polyline PL = tr.GetObject(pLId3, OpenMode.ForRead) as Polyline;
                LineSegment2d li = PL.GetLineSegment2dAt(0);
                Line line1 = PL.GetLineSegment2dAt(0).CLine();
                Line line2 = PL.GetLineSegment2dAt(2).CLine();
                Line line3 = PL.GetLineSegment2dAt(4).CLine();
                Line line4 = PL.GetLineSegment2dAt(6).CLine();

                LineSegment2d li0 = PL1.GetLineSegment2dAt(0);
                LineSegment2d li2 = PL1.GetLineSegment2dAt(2);

                int stIndex = 0;
                int endIndex = 0;
                int stlIndex = 0;
                int endlIndex = 0;
                Point2d pt1 = pt.C2D(-W * 0.5 + avg + sw + radius, -avgl + radius);
                Point2d pt2 = pt.C2D(W * 0.5 - avg - sw - radius, -L + avgl - radius);
                Point2d pt3 = pt.C2D(-W * 0.5 + avg - radius, -avgl - sl - radius);
                Point2d pt4 = pt.C2D(-W * 0.5 + avg - radius, -L + avgl + sl + radius);

                //for (int i = 0; i < reLst.Count; i++)
                //{
                //    if (reLst[i].X >= li0.StartPoint.X && reLst[i].X <= li0.EndPoint.X)
                //    {
                //        ptTLst.Add(new Point3d(reLst[i].X, pt3.Y + radius, 0));
                //        ptBLst.Add(new Point3d(reLst[i].X, pt4.Y - radius, 0));
                //    }
                //}

                //for (int i = 0; i < reLLst.Count; i++)
                //{
                //    if (reLLst[i].Y <= li2.StartPoint.Y && reLLst[i].Y >= li2.EndPoint.Y)
                //    {
                //        ptLLst.Add(new Point3d(pt1.X - radius, reLLst[i].Y, 0));
                //        ptRLst.Add(new Point3d(pt2.X + radius, reLLst[i].Y, 0));
                //    }
                //}
                List<double> n8Lst = new List<double>();
                List<Point3d> n8PtLst = new List<Point3d>();
                List<double> n8aLst = new List<double>();
                List<Point3d> n8aPtLst = new List<Point3d>();
                int div = 0;
                for (int i = 0; i < reLst.Count; i++)
                {
                    if (reLst[i].X >= li0.StartPoint.X && reLst[i].X <= li0.EndPoint.X)
                    {
                        ptTLst.Add(new Point3d(reLst[i].X, pt3.Y + radius, 0));
                        ptBLst.Add(new Point3d(reLst[i].X, pt4.Y - radius, 0));

                        if ((div) % 3 == 0 || div == spancmLst.Count - 2)
                        {
                            if (div == spancmLst.Count - 2)
                            {
                                int di = div % 3;
                                PLPloter.AddLine(db,reLst[i + di].C2D(radius, radius), reBLst[i + di].C2D(radius, -radius), ref ext, "H钢筋");
                                n8aPtLst.Add(reLst[i + di].C3D(radius, radius));
                                if (n8aPtLst.Count > 1)
                                {
                                    n8aLst.Add(n8aPtLst[n8aPtLst.Count - 1].X - n8aPtLst[n8aPtLst.Count - 2].X);
                                }
                            }
                            else
                            {
                                PLPloter.AddLine(db,reLst[i].C2D(-radius, radius), reBLst[i].C2D(-radius, -radius), ref ext, "H钢筋");
                                  n8aPtLst.Add(reLst[i].C3D(-radius, radius));
                                if(n8aPtLst.Count>1)
                                {
                                    n8aLst.Add(n8aPtLst[n8aPtLst.Count-1].X- n8aPtLst[n8aPtLst.Count - 2].X);
                                }
                            }
                        }
                        div++;
                    }
                    else
                    {
                        if (reLst[i].X < li0.StartPoint.X)
                        {
                            n8aPtLst.Add(reLst[spancsLst.Count].C3D(radius, radius));
                            if (n8aPtLst.Count > 1)
                            {
                                n8aLst.Add(n8aPtLst[n8aPtLst.Count - 1].X - n8aPtLst[n8aPtLst.Count - 2].X);
                            }
                        }

                        if (reLst[i].X > li0.EndPoint.X)
                        {
                            n8aPtLst.Add(reLst[reLst.Count - 1 - spancsLst.Count].C3D(-radius, radius));
                            if (n8aPtLst.Count > 1)
                            {
                                n8aLst.Add(n8aPtLst[n8aPtLst.Count - 1].X - n8aPtLst[n8aPtLst.Count - 2].X);
                            }
                        }
                    }
                }
                div = 0;
                for (int i = 0; i < reLLst.Count; i++)
                {
                    if (reLLst[i].Y <= li2.StartPoint.Y + pierPara.pierRebar.main_l_space*2 && reLLst[i].Y >= li2.EndPoint.Y)
                    {
                        ptLLst.Add(new Point3d(pt1.X - radius, reLLst[i].Y, 0));
                        ptRLst.Add(new Point3d(pt2.X + radius, reLLst[i].Y, 0));
                        
                        if ((div) % 3 == 0 || div == reLLst.Count-spancslLst.Count*2 - 6)
                        {
                            if (div == reLLst.Count - spancslLst.Count * 2 - 6)
                            {
                                int di = div % 3;
                                PLPloter.AddLine(db,reLLst[i + di].C2D(-radius, radius), reRLst[i + di].C2D(radius, radius), ref ext, "H钢筋");
                                n8PtLst.Add(reLLst[i + di].C3D(-radius, radius));
                                if (n8PtLst.Count > 1)
                                {
                                    n8Lst.Add(n8PtLst[n8PtLst.Count - 1].Y - n8PtLst[n8PtLst.Count - 2].Y);
                                }
                            }
                            else
                            {
                                PLPloter.AddLine(db,reLLst[i].C2D(-radius, -radius), reRLst[i].C2D(radius, -radius), ref ext, "H钢筋");
                                n8PtLst.Add(reLLst[i].C3D(-radius, -radius));
                                if (n8PtLst.Count > 1)
                                {
                                    n8Lst.Add(n8PtLst[n8PtLst.Count - 1].Y - n8PtLst[n8PtLst.Count - 2].Y);
                                }
                            }
                        }
                        div++;
                    }
                    else
                    {
                        if (reLLst[i].Y < li2.EndPoint.Y)
                        {
                            n8PtLst.Add(reLLst[spancsLst.Count].C3D(-radius, radius));
                            if (n8Lst.Count > 1)
                            {
                                n8Lst.Add(n8PtLst[n8PtLst.Count - 1].Y - n8PtLst[n8PtLst.Count - 2].Y);
                            }
                        }

                        if (reLLst[i].Y > li2.StartPoint.Y)
                        {
                            n8PtLst.Add(reLLst[reLLst.Count - 1 - spancsLst.Count].C3D(-radius, -radius));
                            if (n8Lst.Count > 1)
                            {
                                n8Lst.Add(n8PtLst[n8PtLst.Count - 1].Y - n8PtLst[n8PtLst.Count - 2].Y);
                            }
                        }
                    }
                }

                n8Lst.Reverse();
                RebarPLPloter.CreateLineArrowDBNew(db, ref ext, n8PtLst[n8PtLst.Count - 1].C3D(topThickness*0.45), ArrowDirection.North, n8Lst, new List<double>(), "8", scale, true, 10, 0);
                RebarPLPloter.CreateLineArrowDBNew(db, ref ext, n8aPtLst[0].C3D(0, -topThickness * 0.45), ArrowDirection.West, new List<double>(), n8aLst, "8a", scale, true, 0, 8*scale);

                N8BN = n8PtLst.Count;
                N8aBN = n8aPtLst.Count;

                LineSegment2d li1 = PL1.GetLineSegment2dAt(1);

                Line l1 = new Line(li1.StartPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li1.EndPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

                double lenLine = l1.Length;
                Point3d p1 = MathExtensions.GetIntersection(l1, line1);
                Point3d p2 = MathExtensions.GetIntersection(l1, line2);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine / 3).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                Point3d pp2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine * 2 / 3).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptRTLst.Add(pp1);
                ptRTLst.Add(pp2);

                LineSegment2d li3 = PL1.GetLineSegment2dAt(3);
                Line l3 = new Line(li3.StartPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li3.EndPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

                p1 = MathExtensions.GetIntersection(l3, line2);
                p2 = MathExtensions.GetIntersection(l3, line3);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                pp1 = MathExtensions.GetPointOnTheLine(l3.StartPoint.C2D(), l3.EndPoint.C2D(), lenLine / 3).C3D(radius * Math.Cos(ang), -radius * Math.Sin(ang));
                pp2 = MathExtensions.GetPointOnTheLine(l3.StartPoint.C2D(), l3.EndPoint.C2D(), lenLine * 2 / 3).C3D(radius * Math.Cos(ang), -radius * Math.Sin(ang));
                ptRBLst.Add(pp1);
                ptRBLst.Add(pp2);

                LineSegment2d li5 = PL1.GetLineSegment2dAt(5);
                Line l5 = new Line(li5.StartPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li5.EndPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

                p1 = MathExtensions.GetIntersection(l5, line3);
                p2 = MathExtensions.GetIntersection(l5, line4);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                pp1 = MathExtensions.GetPointOnTheLine(l5.StartPoint.C2D(), l5.EndPoint.C2D(), lenLine / 3).C3D(-radius * Math.Cos(ang), -radius * Math.Sin(ang));
                pp2 = MathExtensions.GetPointOnTheLine(l5.StartPoint.C2D(), l5.EndPoint.C2D(), lenLine * 2 / 3).C3D(-radius * Math.Cos(ang), -radius * Math.Sin(ang));
                ptLBLst.Add(pp1);
                ptLBLst.Add(pp2);

                LineSegment2d li7 = PL1.GetLineSegment2dAt(7);
                Line l7 = new Line(li7.StartPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li7.EndPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

                p1 = MathExtensions.GetIntersection(l7, line1);
                p2 = MathExtensions.GetIntersection(l7, line4);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                pp1 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine / 3).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                pp2 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine * 2 / 3).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptLTLst.Add(pp1);
                ptLTLst.Add(pp2);

                Point3d ptN5 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine / 2).C3D();
                RebarDimPloter.CreateHookLineMark(db, ref ext, ptN5, "3b", 3 * scale, scale, 315);
                tr.Commit();
            }

            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptTLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptBLst, scale, 0, false);

            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRLst, scale, 0, false);

            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRTLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRBLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLTLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLBLst, scale, 0, false);

            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_LEFT, ptRLst, "2a", 1, 0, scale, false, 3 * scale);
            SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_BOTTOM, ptBLst, "2b", ptBLst.Count / 15, ptBLst.Count / 10, scale, false, 3.5 * scale);
            //SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_BOTTOM, ptBLst, "3", ptBLst.Count / 10, ptBLst.Count / 10, scale, false, 4.5 * scale);
            SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_TOP, reBLst, "1", ptBLst.Count / 10, ptBLst.Count / 10, scale, false, 4.5 * scale);

            if (pierPara.pierRebar.is_out_double && pierPara.pierRebar.tendon_length > 0)
            {
                SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_BOTTOM, reTeLst, "1c", reTeLst.Count / 10, reTeLst.Count / 10, scale, false, 4.5 * scale);
            }
            List<Point3d> listN1T = new List<Point3d>();
            List<Point3d> listN1M = new List<Point3d>();
            List<Point3d> listN1B = new List<Point3d>();
            List<Point3d> listN2T = new List<Point3d>();
            List<Point3d> listN2B = new List<Point3d>();
            //for (int i = 0; i < reRLst.Count; i++)
            for (int i = 1; i < reRLst.Count - 1; i++)
            {
                //if (i <= spancslLst.Count)
                //    listN1T.Add(reRLst[i]);
                //else if (i > spancslLst.Count && i <= spancslLst.Count + changeNum)
                //    listN2T.Add(reRLst[i]);
                //else if (i > spancslLst.Count + changeNum && i <= spancslLst.Count + changeNum + spancmlLst.Count)
                //    listN1M.Add(reRLst[i]);
                //else if (i > spancslLst.Count + changeNum + spancmlLst.Count && i < reRLst.Count - 1 - spancslLst.Count)
                //    listN2B.Add(reRLst[i]);
                //else
                //    listN1B.Add(reRLst[i]);
                if (i <= spancslLst.Count)
                    listN1T.Add(reRLst[i]);
                else if (i > spancslLst.Count && i <= spancslLst.Count + changeNum)
                    listN2T.Add(reRLst[i]);
                else if (i >= reRLst.Count - 1 - spancslLst.Count - changeNum && i < reRLst.Count - 1 - spancslLst.Count)
                    listN2B.Add(reRLst[i]);
                else if (i >= reRLst.Count - 1 - spancslLst.Count)
                    listN1B.Add(reRLst[i]);
                else
                    listN1M.Add(reRLst[i]);
            }

            SteelBarPileCap.CreateLineList(db, ref ext, listN1T, eDirection.E_RIGHT, 5 * scale, "H细线");
            Point3d pttxt = GeTools.MidPoint(listN1T[0], listN1T[listN1T.Count - 1]);
            TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "1a", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            SteelBarPileCap.CreateLineList(db, ref ext, listN1M, eDirection.E_RIGHT, 5 * scale, "H细线");
            pttxt = GeTools.MidPoint(listN1M[0], listN1M[listN1M.Count - 1]);
            TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "1b", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            SteelBarPileCap.CreateLineList(db, ref ext, listN1B, eDirection.E_RIGHT, 5 * scale, "H细线");
            pttxt = GeTools.MidPoint(listN1B[0], listN1B[listN1B.Count - 1]);
            TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "1a", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            if (changeNum > 0)
            {
                SteelBarPileCap.CreateLineList(db, ref ext, listN2T, eDirection.E_RIGHT, 5 * scale, "H细线");
                pttxt = GeTools.MidPoint(listN2T[0], listN2T[listN2T.Count - 1]);
                TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "2", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
                SteelBarPileCap.CreateLineList(db, ref ext, listN2B, eDirection.E_RIGHT, 5 * scale, "H细线");
                pttxt = GeTools.MidPoint(listN2B[0], listN2B[listN2B.Count - 1]);
                TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "2", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            }
            #endregion

            #region  箍筋
            //List<double> lstLenWSList = new List<double>();
            //List<double> lstLenLSList = new List<double>();
            //int num = spancmLst.Count / pierPara.pierRebar.stirrup_count;
            //if (spancmLst.Count % pierPara.pierRebar.stirrup_count >= pierPara.pierRebar.stirrup_count * 0.25)
            //{
            //    num = num + 1;
            //}
            //List<double> lst = new List<double>();
            //int neA = (int)((pierPara.pierRebar.stirrup_count * num - spancmLst.Count) * 0.5);
            //if (neA > 0)
            //{
            //    for (int i = neA; i > 0; i--)
            //    {
            //        lst.Add(spancaLst[spancaLst.Count - neA]);
            //    }
            //    for (int i = 0; i < spancmLst.Count; i++)
            //    {
            //        lst.Add(spancmLst[spancmLst.Count - neA]);
            //    }
            //    for (int i = neA; i > 0; i--)
            //    {
            //        lst.Add(spancaLst[spancaLst.Count - neA]);
            //    }
            //}
            //else
            //{
            //    lst = spancmLst;
            //    if (lst.Count % pierPara.pierRebar.stirrup_count != 0)
            //    {
            //        for (int i = lst.Count; i < num * pierPara.pierRebar.stirrup_count; i++)
            //        {
            //            lst.Add(lst[0]);
            //        }
            //    }
            //}
            //double wlen = lst.Sum() + 2 * radius;
            //double les = 0;
            //double les0 = 0;
            //Point2d ptS = pt.C2D(-wlen * 0.5, -avgl + radius);
            //Point2d ptBS = pt.C2D(-wlen * 0.5, -L + avgl - radius + sl + radius * 2);
            //for (int i = 0; i < lst.Count; i++)
            //{
            //    les0 += lst[i];
            //    les += lst[i];
            //    if ((i + 1) % pierPara.pierRebar.stirrup_count == pierPara.pierRebar.stirrup_count - 1)
            //    {
            //        PLPloter.AddPloy4(ptS.C2D(les0 - les + les * 0.5 + radius), les * 0.5 + radius, les * 0.5 + radius, sl + radius * 2, ref ext, "H钢筋");
            //        PLPloter.AddPloy4(ptBS.C2D(les0 - les + les * 0.5 + radius), les * 0.5 + radius, les * 0.5 + radius, sl + radius * 2, ref ext, "H钢筋");
            //        lstLenWSList.Add(les);
            //        les = 0;
            //    }
            //}

            //int numl = spancmlLst.Count / pierPara.pierRebar.stirrup_count;
            ////if (spancmlLst.Count % pierPara.pierRebar.stirrup_count > pierPara.pierRebar.stirrup_count * 0.5)
            ////{
            ////    numl = numl + 1;
            ////}
            //List<double> lLst = new List<double>();
            //int neLA = (int)((pierPara.pierRebar.stirrup_count * numl - spancmlLst.Count) * 0.5);
            //if (neLA > 0)
            //{
            //    for (int i = neLA; i > 0; i--)
            //    {
            //        lLst.Add(spancslLst[spancslLst.Count - neLA]);
            //    }
            //    for (int i = 0; i < spancmlLst.Count; i++)
            //    {
            //        lLst.Add(spancmlLst[i]);
            //    }
            //    for (int i = neLA; i > 0; i--)
            //    {
            //        lLst.Add(spancslLst[spancslLst.Count - neLA]);
            //    }
            //}
            //else
            //{
            //    if (spancmlLst.Count > pierPara.pierRebar.stirrup_count * numl)
            //    {
            //        for (int i = 0; i < numl * pierPara.pierRebar.stirrup_count; i++)
            //        {
            //            lLst.Add(spancmlLst[i]);
            //        }
            //    }
            //    else
            //    {
            //        lLst = spancmlLst;
            //        if (lLst.Count % pierPara.pierRebar.stirrup_count != 0)
            //        {
            //            for (int i = lLst.Count; i < numl * pierPara.pierRebar.stirrup_count; i++)
            //            {
            //                lLst.Add(lst[0]);
            //            }
            //        }
            //    }
            //}
            //double wLlen = lLst.Sum();
            //les = 0;
            //les0 = 0;
            //Point2d ptS1 = pt.C2D(-pierPara.column.top_w * 0.5 + avg + sw * 0.5, -avgl - sl - (vL - lenL) * 0.5);
            //Point2d ptBS1 = pt.C2D(pierPara.column.top_w * 0.5 - avg - sw * 0.5, -avgl - sl - (vL - lenL) * 0.5);
            ////for (int i = 0; i < lLst.Count; i++)
            ////{
            ////    les0 += lLst[i];
            ////    les += lLst[i];
            ////    if ((i+1) % pierPara.pierRebar.stirrup_count == pierPara.pierRebar.stirrup_count - 1)
            ////    {
            ////        PLPloter.AddPloy4(ptS.C2D(0, -(les0 - les ) + radius), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
            ////        PLPloter.AddPloy4(ptBS.C2D(0, -(les0 -les) + radius), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
            ////        les = 0;
            ////    }
            ////}
            //int div = 0;
            //bool isAdd = false;
            //for (int i = 0; i < lLst.Count; i++)
            //{
            //    les0 += lLst[i];
            //    les += lLst[i];
            //    if (lLst.Count % pierPara.pierRebar.stirrup_count == 0)
            //    {
            //        if ((i + 1) % pierPara.pierRebar.stirrup_count == 0)
            //        {
            //            PLPloter.AddPloy4(ptS1.C2D(0, -(les0 - les - radius)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
            //            PLPloter.AddPloy4(ptBS1.C2D(0, -(les0 - les - radius)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
            //            lstLenLSList.Add(les);
            //            les = 0;
            //        }
            //    }

            //}
            #endregion

            #region 180°弯钩
            //List<double> l180List = new List<double>();
            //List<Point2d> lTPtList = new List<Point2d>();
            //List<Point2d> lBPtList = new List<Point2d>();
            //for (int i = 0; i < pierPara.pierRebar.main_l_change_num; i++)
            //{
            //    if (i % 2 == 1)
            //    {
            //        if (pierPara.pierRebar.main_l_change_num % 2 != 0)
            //        {
            //            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -(avgl + sl + (i + 1) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -(avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -(avgl + sl + (i + 1) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -(avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //            lTPtList.Add(pt.C2D(-W * 0.5 + avg - radius + sw * 0.5, -(avgl + sl + (i + 1) * spChange) + radius));
            //            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + (avgl + sl + (i + 1) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + (avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + (avgl + sl + (i + 1) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + (avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //            lBPtList.Add(pt.C2D(-W * 0.5 + avg - radius + sw * 0.5, -L + (avgl + sl + (i + 1) * spChange) + radius));

            //            PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -(avgl + sl + (i + 1) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -(avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //            PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -(avgl + sl + (i + 1) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -(avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //            PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -L + (avgl + sl + (i + 1) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + (avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //            PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -L + (avgl + sl + (i + 1) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + (avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //            //if (i!=1)
            //            l180List.Add(2 * spChange);
            //        }
            //        else
            //        {
            //            if (i != pierPara.pierRebar.main_l_change_num - 1)
            //            {
            //                PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -(avgl + sl + (i + 1) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -(avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //                PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -(avgl + sl + (i + 1) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -(avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //                lTPtList.Add(pt.C2D(-W * 0.5 + avg - radius + sw * 0.5, -(avgl + sl + (i + 1) * spChange) + radius));
            //                PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + (avgl + sl + (i + 1) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + (avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //                PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + (avgl + sl + (i + 1) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + (avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //                lBPtList.Add(pt.C2D(-W * 0.5 + avg - radius + sw * 0.5, -L + (avgl + sl + (i + 1) * spChange) + radius));

            //                PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -(avgl + sl + (i + 1) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -(avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //                PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -(avgl + sl + (i + 1) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -(avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //                PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -L + (avgl + sl + (i + 1) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + (avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //                PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -L + (avgl + sl + (i + 1) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + (avgl + sl + (i + 1) * spChange) + radius), ref ext, "H钢筋");
            //                //if (i != 1)
            //                l180List.Add(2 * spChange);
            //            }
            //        }
            //    }
            //    //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg-radius, -(avgl+sl + (pierPara.pierRebar.main_l_change_num/3)*spChange) + radius), pt.C2D(-W * 0.5 + avg+sw+radius, -(avgl + sl + (pierPara.pierRebar.main_l_change_num / 3) * spChange) + radius), ref ext, "H钢筋");
            //    //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -(avgl + sl + (pierPara.pierRebar.main_l_change_num*2 / 3) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -(avgl + sl + (pierPara.pierRebar.main_l_change_num * 2 / 3) * spChange) + radius), ref ext, "H钢筋");

            //    //PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -(avgl + sl + (pierPara.pierRebar.main_l_change_num / 3) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw -radius, -(avgl + sl + (pierPara.pierRebar.main_l_change_num / 3) * spChange) + radius), ref ext, "H钢筋");
            //    //PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -(avgl + sl + (pierPara.pierRebar.main_l_change_num * 2 / 3) * spChange) + radius), pt.C2D(W * 0.5 -avg - sw - radius, -(avgl + sl + (pierPara.pierRebar.main_l_change_num * 2 / 3) * spChange) + radius), ref ext, "H钢筋");

            //    //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + (avgl + sl + (pierPara.pierRebar.main_l_change_num / 3) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + (avgl + sl + (pierPara.pierRebar.main_l_change_num / 3) * spChange) + radius), ref ext, "H钢筋");
            //    //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + (avgl + sl + (pierPara.pierRebar.main_l_change_num * 2 / 3) * spChange) + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + (avgl + sl + (pierPara.pierRebar.main_l_change_num * 2 / 3) * spChange) + radius), ref ext, "H钢筋");

            //    //PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -L + (avgl + sl + (pierPara.pierRebar.main_l_change_num / 3) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + (avgl + sl + (pierPara.pierRebar.main_l_change_num / 3) * spChange) + radius), ref ext, "H钢筋");
            //    //PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg + radius, -L + (avgl + sl + (pierPara.pierRebar.main_l_change_num * 2 / 3) * spChange) + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + (avgl + sl + (pierPara.pierRebar.main_l_change_num * 2 / 3) * spChange) + radius), ref ext, "H钢筋");

            //}
            #endregion

            List<double> lList = new List<double>();
            lList.Add(sl + radius * 2);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, pt.C3D(pierPara.column.top_w * 0.15 + 5, -L + avgl - radius), ArrowDirection.North, new List<double>(), new List<double>(), "3", scale, true, 5, 0);

            //lList = new List<double>();
            //lList.Add(sw + radius * 2);
            //RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBS1.C3D(0, radius), ArrowDirection.North, lstLenLSList, new List<double>(), "5a", scale, false, 18, 0 * scale);

            //lList = new List<double>();
            //lList.Add(sw + radius * 2);
            //RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptS.C3D(0, -sl * 0.5), ArrowDirection.West, new List<double>(), lstLenWSList, "4a", scale, false, 18, 0);

            //if (l180List.Count > 0)
            //{
            //    RebarPLPloter.CreateLineArrowDBNew(db, ref ext, lTPtList[0].C3D(0, 2 * spChange), ArrowDirection.South, l180List, new List<double>(), "5b", scale, false, 6, 0);
            //    RebarPLPloter.CreateLineArrowDBNew(db, ref ext, lBPtList[lBPtList.Count - 1].C3D(), ArrowDirection.North, l180List, new List<double>(), "5b", scale, false, 10, 0 * scale);
            //}
        }

        #region 平面钢筋网 (无效废弃)
        //public void PlotSectionHH(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        //{
        //    ext = new Extents2d(insertPoint, insertPoint);
        //    TextPloter.AddTitle(db,insertPoint, ref ext, "H-H", "", scale);
        //    Point2d pt = insertPoint.C2D(0, -25 * scale);

        //    double W = pierPara.column.top_w;
        //    double L = pierPara.column.top_l;
        //    if (pierPara.column.slope_w > 0)
        //        W = W + 120;
        //    if (pierPara.column.slope_l > 0)
        //        L = L + 120;

        //    double lenW = Math.Round(spancwLst.Sum(), 1);
        //    double avg = (pierPara.column.top_w - lenW) * 0.5;
        //    double lenL = Math.Round(spanclLst.Sum(), 1);
        //    double avgl = (pierPara.column.top_l - lenL) * 0.5;


        //    string[] sizeOut = pierPara.column.out_section_ang.Split('*');
        //    string[] sizeInner = pierPara.column.inner_section_ang.Split('*');
        //    double outW = double.Parse(sizeOut[0]);
        //    double outL = double.Parse(sizeOut[1]);
        //    double innerW = double.Parse(sizeInner[0]);
        //    double innerL = double.Parse(sizeInner[1]);
        //    ObjectId pLId1 = PLPloter.CreatPoly8(pt.C2D(), ref ext, L, W, "H细线", outL, outW, outL, outW);

        //    //ObjectId pLId2 = PLPloter.CreatPoly8(pt.C2D(0, -topThickness), ref ext, L - 2 * topThickness, W - 2 * topThickness, "H细线", innerW, innerL, innerW, innerL);

        //    //PLPloter.CreatPoly8(pt.C2D(0, -avg + radius), ref ext, L - avg * 2 + radius * 2, W - avg * 2 + radius * 2, "H钢筋", outL, outW, outL, outW);

        //    //List<Point3d> reLst = new List<Point3d>();
        //    //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -avgl),
        //    //        radius, spancwLst, scale, 0, out reLst, false);
        //    //List<Point3d> reBLst = new List<Point3d>();
        //    //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
        //    // radius, spancwLst, scale, 0, out reBLst, false);

        //    //double vL = L - 2 * avg;
        //    //List<double> vLst = new List<double>();
        //    //RebarArrangement.ArrangeSpan(spancslLst, spancmlLst, lenL, vL, out vLst, pierPara.pierRebar.main_l_change_num);

        //    //List<Point3d> reLLst = new List<Point3d>();
        //    //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
        //    //radius, vLst, scale, 0, out reLLst, false, false);
        //    //List<Point3d> reRLst = new List<Point3d>();
        //    //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(W * 0.5 - avg, -L + avgl),
        //    //radius, vLst, scale, 0, out reRLst, false, false);

        //    //double sw = spancsLst.Sum();
        //    //double sl = spancslLst.Sum();
        //    //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg + sw + radius, -avgl + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + avgl - radius), ref ext, "H钢筋");
        //    //PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg - sw - radius, -avgl + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + avgl - radius), ref ext, "H钢筋");
        //    //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -avgl - sl - radius), pt.C2D(W * 0.5 - avg + radius, -avgl - sl - radius), ref ext, "H钢筋");
        //    //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + avgl + sl + radius), pt.C2D(W * 0.5 - avg + radius, -L + avgl + sl + radius), ref ext, "H钢筋");

        //    //double vL = L - 2 * avg;
        //    //List<double> vLst = new List<double>();
        //    //RebarArrangement.ArrangeSpan(spancslLst, spancmlLst, lenL, vL, out vLst, pierPara.pierRebar.main_l_change_num);
        //    //List<Point3d> reLst1 = new List<Point3d>();
        //    //SteelBarPileCap.CreateBatchLine(db, ref ext, pt.C2D(-W * 0.5 + avg + radius, -L + avgl - radius), spancwLst, L - avgl * 2 + radius * 2, out reLst1, false);
        //    //List<Point3d> reLLst1 = new List<Point3d>();
        //    //SteelBarPileCap.CreateBatchLine(db, ref ext, pt.C2D(-W * 0.5 + avg - radius, -L + avgl - radius), vLst, W - avg * 2 + radius * 2, out reLLst1, true);


        //    //string v = avg + "+" + pierPara.pierRebar.main_w_thickness_layout + "+" + pierPara.pierRebar.main_w_angle_layout + "+" + pierPara.pierRebar.main_w_mid_layout + "+" + pierPara.pierRebar.main_w_angle_layout + "+" + pierPara.pierRebar.main_w_thickness_layout + "+" + avg;
        //    //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 5 * scale), ref ext, 0, scale, v, Unit.Centimeter, Unit.Centimeter);
        //    //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);

        //    //string vl = avg + "+" + pierPara.pierRebar.main_l_thickness_layout + "+" + pierPara.pierRebar.main_l_change_num + "*C" + "+" + pierPara.pierRebar.main_l_mid_layout + "+" + pierPara.pierRebar.main_l_change_num + "*C" + "+" + pierPara.pierRebar.main_l_thickness_layout + "+" + avg;
        //    //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5, 0), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, vl, Unit.Centimeter, Unit.Centimeter);
        //    //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale, "Bdi", Unit.Centimeter, Unit.Centimeter);

        //    double spaceLen = spancsLst.Sum();
        //    double spaceLLen = spancslLst.Sum();
        //    List<double> wSPLst = new List<double>();
        //    string wString = "";
        //    RebarArrangement.ArrangeSpace(W - avg * 2 - 2 * spaceLen, pierPara.pierRebar.pier_solid_reinforcement_space, out wSPLst, out wString);

        //    List<double> lSPLst = new List<double>();
        //    string lString = "";
        //    RebarArrangement.ArrangeSpace(L - avgl * 2 - 2 * spaceLen, pierPara.pierRebar.pier_solid_reinforcement_space, out lSPLst, out lString);
        //    List<Point3d> reLst1 = new List<Point3d>();
        //    List<double> lstDimSp = new List<double>();
        //    SteelBarPileCap.CreateBatchLine(db, ref ext, pt.C2D(-W * 0.5 + avg + spaceLen, -L + avgl - radius), wSPLst, L - avgl * 2, out reLst1, out lstDimSp, false);
        //    List<Point3d> reLLst1 = new List<Point3d>();
        //    List<double> lstDimLSp = new List<double>();
        //    SteelBarPileCap.CreateBatchLine(db, ref ext, pt.C2D(-W * 0.5 + avg - radius, -L + avgl + spaceLLen), lSPLst, W - avg * 2, out reLLst1, out lstDimLSp, true);

        //    DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), reLst1[0], pt.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
        //    DimPloter.DimRot(db, pt.C3D(pierPara.column.top_w * 0.5), reLst1[reLst1.Count - 1], pt.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
        //    DimPloter.DimRot(db, reLst1[0], reLst1[reLst1.Count - 1], pt.C3D(0, 5 * scale), ref ext, 0, scale, wString, Unit.Centimeter, Unit.Centimeter);
        //    DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);


        //    DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5, -L), reLLst1[0], pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
        //    DimPloter.DimRot(db, pt.C3D(pierPara.column.top_w * 0.5), reLLst1[reLLst1.Count - 1], pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
        //    DimPloter.DimRot(db, reLLst1[0], reLLst1[reLLst1.Count - 1], pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, "n1×" + pierPara.pierRebar.pier_solid_reinforcement_space, Unit.Centimeter, Unit.Centimeter);
        //    DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale, "Bdi", Unit.Centimeter, Unit.Centimeter);
        //    //string vl = avg + "+" + pierPara.pierRebar.main_l_thickness_layout + "+" + pierPara.pierRebar.main_l_mid_layout + "+" + pierPara.pierRebar.main_l_thickness_layout + "+" + avg;


        //    RebarPLPloter.CreateLineArrowDBNew(db, ref ext, reLLst1[reLLst1.Count - 1].C3D(W * 0.5 + pierPara.pierRebar.pier_solid_reinforcement_space * 0.5), ArrowDirection.North, lstDimLSp, new List<double>(), "6a", scale, true, scale, 0 * scale);
        //    RebarPLPloter.CreateLineArrowDBNew(db, ref ext, reLst1[0].C3D(0, L * 0.5 + pierPara.pierRebar.pier_solid_reinforcement_space * 0.5), ArrowDirection.West, new List<double>(), lstDimSp, "6", scale, true, scale, 0 * scale);
        //}

        //public void PlotSectionGGP(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        //{
        //    ext = new Extents2d(insertPoint, insertPoint);
        //    TextPloter.AddTitle(db,insertPoint, ref ext, "G-G", "", scale);
        //    Point2d pt = insertPoint.C2D(0, -25 * scale);

        //    //PLPloter.AddPloy4(pt, pierPara.column.top_w * 0.5, pierPara.column.top_w * 0.5, pierPara.column.top_l, ref ext, "H细线");


        //    double W = pierPara.column.top_w;
        //    double L = pierPara.column.top_l;

        //    double lenW = Math.Round(spancwLst.Sum(), 1);
        //    double avg = (pierPara.column.top_w - lenW) * 0.5;
        //    double lenL = Math.Round(spanclLst.Sum(), 1);
        //    double avgl = (pierPara.column.top_l - lenL) * 0.5;
        //    //if (pierPara.column.slope_w > 0)
        //    //    W = W + 100;
        //    //if (pierPara.column.slope_l > 0)
        //    //    L = L + 100;

        //    string[] sizeOut = pierPara.column.out_section_ang.Split('*');
        //    string[] sizeInner = pierPara.column.inner_section_ang.Split('*');
        //    double outW = double.Parse(sizeOut[0]);
        //    double outL = double.Parse(sizeOut[1]);
        //    double innerW = double.Parse(sizeInner[0]);
        //    double innerL = double.Parse(sizeInner[1]);
        //    ObjectId pLId1 = PLPloter.CreatPoly8(pt.C2D(), ref ext, L, W, "H细线", outL, outW, outL, outW);

        //    //ObjectId pLId2 = PLPloter.CreatPoly8(pt.C2D(0, -topThickness), ref ext, L - 2 * topThickness, W - 2 * topThickness, "H虚线", innerW, innerL, innerW, innerL);

        //    //ObjectId pLId3 = PLPloter.CreatPoly8(pt.C2D(0, -avg + radius), ref ext, L - avg * 2 + radius * 2, W - avg * 2 + radius * 2, "H钢筋", outL, outW, outL, outW);

        //    //List<Point3d> reLst = new List<Point3d>();
        //    //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -avgl),
        //    //        radius, spancwLst, scale, 0, out reLst, false);
        //    //List<Point3d> reBLst = new List<Point3d>();
        //    //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
        //    // radius, spancwLst, scale, 0, out reBLst, false);

        //    //List<Point3d> reLLst = new List<Point3d>();
        //    //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
        //    //radius, spanclLst, scale, 0, out reLLst, false, false);

        //    //List<Point3d> reRLst = new List<Point3d>();
        //    //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(W * 0.5 - avg, -L + avgl),
        //    //radius, spanclLst, scale, 0, out reRLst, false, false);
        //    double spaceLen = spancsLst.Sum();
        //    double spaceLLen = spancslLst.Sum();
        //    List<double> wSPLst = new List<double>();
        //    string wString = "";
        //    RebarArrangement.ArrangeSpace(W - avg * 2 - 2 * spaceLen, pierPara.pierRebar.pier_solid_reinforcement_space, out wSPLst, out wString);

        //    List<double> lSPLst = new List<double>();
        //    string lString = "";
        //    RebarArrangement.ArrangeSpace(L - avgl * 2 - 2 * spaceLen, pierPara.pierRebar.pier_solid_reinforcement_space, out lSPLst, out lString);
        //    List<Point3d> reLst1 = new List<Point3d>();
        //    List<double> lstDimSp = new List<double>();
        //    SteelBarPileCap.CreateBatchLine(db, ref ext, pt.C2D(-W * 0.5 + avg + spaceLen, -L + avgl - radius), wSPLst, L - avgl * 2, out reLst1, out lstDimSp, false);
        //    List<Point3d> reLLst1 = new List<Point3d>();
        //    List<double> lstDimLSp = new List<double>();
        //    SteelBarPileCap.CreateBatchLine(db, ref ext, pt.C2D(-W * 0.5 + avg - radius, -L + avgl + spaceLLen), lSPLst, W - avg * 2, out reLLst1, out lstDimLSp, true);

        //    double sw = spancsLst.Sum();
        //    double sl = spancslLst.Sum();
        //    //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg + sw + radius, -avgl + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + avgl - radius), ref ext, "H钢筋");
        //    //PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg - sw - radius, -avgl + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + avgl - radius), ref ext, "H钢筋");
        //    //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -avgl - sl - radius), pt.C2D(W * 0.5 - avg + radius, -avgl - sl - radius), ref ext, "H钢筋");
        //    //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + avgl + sl + radius), pt.C2D(W * 0.5 - avg + radius, -L + avgl + sl + radius), ref ext, "H钢筋");

        //    //string v = avg + "+" + pierPara.pierRebar.main_w_thickness_layout + "+" + pierPara.pierRebar.main_w_angle_layout + "+" + pierPara.pierRebar.main_w_mid_layout + "+" + pierPara.pierRebar.main_w_angle_layout + "+" + pierPara.pierRebar.main_w_thickness_layout + "+" + avg;
        //    DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), reLst1[0], pt.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
        //    DimPloter.DimRot(db, pt.C3D(pierPara.column.top_w * 0.5), reLst1[reLst1.Count - 1], pt.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
        //    DimPloter.DimRot(db, reLst1[0], reLst1[reLst1.Count - 1], pt.C3D(0, 5 * scale), ref ext, 0, scale, wString, Unit.Centimeter, Unit.Centimeter);
        //    DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);


        //    DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5, -L), reLLst1[0], pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
        //    DimPloter.DimRot(db, pt.C3D(pierPara.column.top_w * 0.5), reLLst1[reLLst1.Count - 1], pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
        //    DimPloter.DimRot(db, reLLst1[0], reLLst1[reLLst1.Count - 1], pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, lString, Unit.Centimeter, Unit.Centimeter);
        //    DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
        //    //string vl = avg + "+" + pierPara.pierRebar.main_l_thickness_layout + "+" + pierPara.pierRebar.main_l_mid_layout + "+" + pierPara.pierRebar.main_l_thickness_layout + "+" + avg;
        //    //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5, 0), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, vl, Unit.Centimeter, Unit.Centimeter);
        //    //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);


        //    RebarPLPloter.CreateLineArrowDBNew(db, ref ext, reLLst1[reLLst1.Count - 1].C3D(W * 0.5 + pierPara.pierRebar.pier_solid_reinforcement_space * 0.5), ArrowDirection.North, lstDimLSp, new List<double>(), "6a", scale, true, scale, 0 * scale);
        //    RebarPLPloter.CreateLineArrowDBNew(db, ref ext, reLst1[0].C3D(0, L * 0.5 + pierPara.pierRebar.pier_solid_reinforcement_space * 0.5), ArrowDirection.West, new List<double>(), lstDimSp, "6", scale, true, scale, 0 * scale);
        //    #region 内部点筋
        //    //List<Point3d> ptTLst = new List<Point3d>();
        //    //List<Point3d> ptBLst = new List<Point3d>();

        //    //List<Point3d> ptLLst = new List<Point3d>();
        //    //List<Point3d> ptRLst = new List<Point3d>();

        //    //List<Point3d> ptLTLst = new List<Point3d>();
        //    //List<Point3d> ptRTLst = new List<Point3d>();
        //    //List<Point3d> ptLBLst = new List<Point3d>();
        //    //List<Point3d> ptRBLst = new List<Point3d>();

        //    //double ang = Math.Atan(innerW / innerL);
        //    //using (Transaction tr = db.TransactionManager.StartTransaction())
        //    //{
        //    //    BlockTable blockTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
        //    //    LayerTable lt = tr.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable;
        //    //    BlockTableRecord modelSpace;
        //    //    modelSpace = tr.GetObject(blockTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
        //    //    Polyline PL1 = tr.GetObject(pLId2, OpenMode.ForRead) as Polyline;
        //    //    Polyline PL = tr.GetObject(pLId3, OpenMode.ForRead) as Polyline;
        //    //    LineSegment2d li = PL.GetLineSegment2dAt(0);
        //    //    Line line1 = PL.GetLineSegment2dAt(0).CLine();
        //    //    Line line2 = PL.GetLineSegment2dAt(2).CLine();
        //    //    Line line3 = PL.GetLineSegment2dAt(4).CLine();
        //    //    Line line4 = PL.GetLineSegment2dAt(6).CLine();

        //    //    LineSegment2d li0 = PL1.GetLineSegment2dAt(0);
        //    //    LineSegment2d li2 = PL1.GetLineSegment2dAt(2);

        //    //    int stIndex = 0;
        //    //    int endIndex = 0;
        //    //    int stlIndex = 0;
        //    //    int endlIndex = 0;
        //    //    Point2d pt1 = pt.C2D(-W * 0.5 + avg + sw + radius, -avgl + radius);
        //    //    Point2d pt2 = pt.C2D(W * 0.5 - avg - sw - radius, -L + avgl - radius);
        //    //    Point2d pt3 = pt.C2D(-W * 0.5 + avg - radius, -avgl - sl - radius);
        //    //    Point2d pt4 = pt.C2D(-W * 0.5 + avg - radius, -L + avgl + sl + radius);

        //    //    for (int i = 0; i < reLst.Count; i++)
        //    //    {
        //    //        if (reLst[i].X >= li0.StartPoint.X && reLst[i].X <= li0.EndPoint.X)
        //    //        {
        //    //            ptTLst.Add(new Point3d(reLst[i].X, pt3.Y + radius, 0));
        //    //            ptBLst.Add(new Point3d(reLst[i].X, pt4.Y - radius, 0));
        //    //        }
        //    //    }

        //    //    for (int i = 0; i < reLLst.Count; i++)
        //    //    {
        //    //        if (reLLst[i].Y <= li2.StartPoint.Y && reLLst[i].Y >= li2.EndPoint.Y)
        //    //        {
        //    //            ptLLst.Add(new Point3d(pt1.X - radius, reLLst[i].Y, 0));
        //    //            ptRLst.Add(new Point3d(pt2.X + radius, reLLst[i].Y, 0));
        //    //        }
        //    //    }

        //    //    LineSegment2d li1 = PL1.GetLineSegment2dAt(1);

        //    //    Line l1 = new Line(li1.StartPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li1.EndPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

        //    //    double lenLine = l1.Length;
        //    //    Point3d p1 = MathExtensions.GetIntersection(l1, line1);
        //    //    Point3d p2 = MathExtensions.GetIntersection(l1, line2);
        //    //    PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
        //    //    Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine / 3).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
        //    //    Point3d pp2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine * 2 / 3).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
        //    //    ptRTLst.Add(pp1);
        //    //    ptRTLst.Add(pp2);

        //    //    LineSegment2d li3 = PL1.GetLineSegment2dAt(3);
        //    //    Line l3 = new Line(li3.StartPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li3.EndPoint.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

        //    //    p1 = MathExtensions.GetIntersection(l3, line2);
        //    //    p2 = MathExtensions.GetIntersection(l3, line3);
        //    //    PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
        //    //    pp1 = MathExtensions.GetPointOnTheLine(l3.StartPoint.C2D(), l3.EndPoint.C2D(), lenLine / 3).C3D(radius * Math.Cos(ang), -radius * Math.Sin(ang));
        //    //    pp2 = MathExtensions.GetPointOnTheLine(l3.StartPoint.C2D(), l3.EndPoint.C2D(), lenLine * 2 / 3).C3D(radius * Math.Cos(ang), -radius * Math.Sin(ang));
        //    //    ptRBLst.Add(pp1);
        //    //    ptRBLst.Add(pp2);

        //    //    LineSegment2d li5 = PL1.GetLineSegment2dAt(5);
        //    //    Line l5 = new Line(li5.StartPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li5.EndPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

        //    //    p1 = MathExtensions.GetIntersection(l5, line3);
        //    //    p2 = MathExtensions.GetIntersection(l5, line4);
        //    //    PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
        //    //    pp1 = MathExtensions.GetPointOnTheLine(l5.StartPoint.C2D(), l5.EndPoint.C2D(), lenLine / 3).C3D(-radius * Math.Cos(ang), -radius * Math.Sin(ang));
        //    //    pp2 = MathExtensions.GetPointOnTheLine(l5.StartPoint.C2D(), l5.EndPoint.C2D(), lenLine * 2 / 3).C3D(-radius * Math.Cos(ang), -radius * Math.Sin(ang));
        //    //    ptLBLst.Add(pp1);
        //    //    ptLBLst.Add(pp2);

        //    //    LineSegment2d li7 = PL1.GetLineSegment2dAt(7);
        //    //    Line l7 = new Line(li7.StartPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), li7.EndPoint.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));

        //    //    p1 = MathExtensions.GetIntersection(l7, line1);
        //    //    p2 = MathExtensions.GetIntersection(l7, line4);
        //    //    PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
        //    //    pp1 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine / 3).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
        //    //    pp2 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine * 2 / 3).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
        //    //    ptLTLst.Add(pp1);
        //    //    ptLTLst.Add(pp2);
        //    //    tr.Commit();
        //    //}

        //    //SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptTLst, scale, 0, false);
        //    //SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptBLst, scale, 0, false);

        //    //SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLLst, scale, 0, false);
        //    //SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRLst, scale, 0, false);

        //    //SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRTLst, scale, 0, false);
        //    //SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRBLst, scale, 0, false);
        //    //SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLTLst, scale, 0, false);
        //    //SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLBLst, scale, 0, false);
        //    #endregion


        //}
        #endregion

        #endregion

        #region 注释和表格
        public void PlotPierNote(ref Database db, out Extents2d ext, Point2d insertPoint, List<PierPara> pierDisList, int scale = 1)
        {
            ext = new Extents2d(insertPoint, insertPoint);

         
            double height = 0;
            double width = 0;
            Point3d ptT0 = insertPoint.C3D(0, 10 * scale);
            DrawParaTable(db, ref ext, ptT0.C3D(), pierDisList,ref height,ref width, Extensions.curFont, scale);
            Point3d ptT = ptT0.C3D(0,-height-5*scale);
            string n = "(H/" + 1 / (pierPara.column.slope_l)+"+" + (pierPara.column.top_l-2*topThickness)*0.5+")/ " + pierPara.pierRebar.middle_encryption_spacing;
            string text = @"注:
  1.本图尺寸除高程以米为单位外，余均以厘米为单位。
  2.图中所示保护层厚度为箍筋净保护层厚度。"
  + @"\P  3.横隔板处钢筋布置未在墩身钢筋构造图示意。"
  + @"\P  4.实心段钢筋网以" + pierPara.pierRebar.pier_solid_reinforcement_space + "cm间距布置，倒角钢筋网以" + pierPara.pierRebar.pier_angle_reinforcement_space + "cm间距布置\\P"
  + @"  5.N1a钢筋平行斜坡布置,N2钢筋竖向布置和N1a,N1b钢筋之间的关系参照N2钢筋布置示意。
  6.N3,N4,N5系列钢筋采用单面焊焊接，焊缝长度不小于10D，,N3,N5,N6,N8a,N9,N10a钢筋下料时，根据实际间距计算长度，钢筋明细表只给出均长度。
  7.本图适用于" + pierPara.name + "墩,各墩横隔板位置详见“桥墩及基础一般构造”。";
            Point3d p = ptT.C3D(0, 0);
            TextPloter.AddMText(db,p, ref ext, text, scale, 3, 125 * scale, Extensions.curFont);

        }

        public void PlotPierSampleNote(ref Database db, ref Extents2d ext, Point2d insertPoint, int scale = 1)
        {
            //ext = new Extents2d(insertPoint, insertPoint);

            Point3d ptT = insertPoint.C3D();
            string n = "(H-" + pierPara.pierRebar.top_encryption_length / pierPara.pierRebar.top_encryption_spacing + "×" + pierPara.pierRebar.top_encryption_spacing + "-" + pierPara.pierRebar.bottom_encryption_length / pierPara.pierRebar.bottom_encryption_spacing + "×" + pierPara.pierRebar.bottom_encryption_spacing + ")/ " + pierPara.pierRebar.middle_encryption_spacing;
            string text = @"注:
  1.本图尺寸除高程以米为单位外，余均以厘米为单位。
  2.图中所示保护层厚度为箍筋净保护层厚度，L为墩身高度。"
  + @"\P  3.1a筋平行斜坡布置,N2号筋竖向布置和1a,1b钢筋之间的关系参照2号筋布置示意。
  4.对标有'均'长度的钢筋，施工时应根据其具体位置施工放样后再测量下料。
  5.4,5系列钢筋采用焊接，焊接缝长度不小于5d。
  6.本图适用于" + pierPara.name + "墩。";
            Point3d p = insertPoint.C3D(0, 0);
            TextPloter.AddMText(db,p, ref ext, text, scale, 3, 100 * scale, Extensions.curFont);

        }

        #endregion

        #region 横隔板
        //double lenN9 = 0;
        public void PlotPierBlockA(ref Database db, out Extents2d ext, Point2d insertPoint, double scale)
        {
            scale = scale * extendscale;
            ext = new Extents2d(insertPoint, insertPoint);
            if (BulkheadCount > 0)
            {
                TextPloter.AddTitle(db,insertPoint, ref ext, "横隔板钢筋布置立面", "", scale);
                Point2d pt = insertPoint.C2D(0, -3 * scale);


                string[] sizeM = pierPara.column.section_mid_w_ang.Split('*');
                string[] sizeBulk = pierPara.column.bulkhead_size_w.Split('*');
                //string[] sizeBulkL = pierPara.column.bulkhead_size_l.Split('*');

                double mH = double.Parse(sizeM[1]);
                double mw = double.Parse(sizeM[0]);
                double bH = double.Parse(sizeBulk[1]);
                double bw = double.Parse(sizeBulk[0]);
                //double bwL = double.Parse(sizeBulkL[1]);

                #region 钢筋绘制

                double lenW = Math.Round(spancwLst.Sum(), 1);
                double avg = (pierPara.column.top_w - lenW) * 0.5;
                double spaceLen = spancsLst.Sum();

                MH = (mH + bH) * 3;
                #endregion
                #region 横隔板
                Point2d ptCF1 = pt.C2D(-pierPara.column.top_w * 0.5);
                Point2d ptCF2 = pt.C2D(pierPara.column.top_w * 0.5);
                Point2d ptCM1 = ptCF1.C2D();
                Point2d ptCM2 = ptCF2.C2D();
                Point2d ptCM1E = ptCF1.C2D(0, -MH);
                Point2d ptCM2E = ptCF2.C2D(0, -MH);


                PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(-5 * scale), ptCM2.C2D(5 * scale), scale, "H细线");

                PLPloter.AddLine(db,ptCM1, ptCM1E, ref ext, "H细线");
                PLPloter.AddLine(db,ptCM2, ptCM2E, ref ext, "H细线");

                PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale), ptCM2E.C2D(5 * scale), scale, "H细线");

                #region 钢筋
                double len = 0;
                PLPloter.AddLine(db,ptCM1.C2D(avg), ptCM1E.C2D(avg), ref ext, "H钢筋");
                for (int m = 0; m < spancwLst.Count; m++)
                {
                    len += spancwLst[m];
                    if (m == spancsLst.Count - 1 || m == spancwLst.Count - spancsLst.Count - 1 || m == spancwLst.Count - 1)
                        PLPloter.AddLine(db,ptCM1.C2D(avg + len), ptCM1E.C2D(avg + len), ref ext, "H钢筋");
                }


                int numR = (int)((MH) / pierPara.pierRebar.middle_encryption_spacing);
                double lenH = 0;
                for (int m = 1; m <= numR - 1; m++)
                {
                    lenH += pierPara.pierRebar.middle_encryption_spacing;

                    PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                    PLPloter.AddLine(db,ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                }


                Point2d ptICM1 = ptCF1.C2D(0, 0);
                Point2d ptICM2 = ptCF2.C2D(0, 0);
                double HB = (MH - mH * 2 - bH) * 0.5;

                Point2d ptICM = pt.C2D(0, -HB - mH);
                List<Point2d> ptLst = new List<Point2d>();
                ptICM1 = ptCF1.C2D(topThickness, 0);
                ptICM2 = ptCF2.C2D(-topThickness, 0);
                Point2d ptICM3 = ptCF1.C2D(topThickness, -HB);
                Point2d ptICM4 = ptCF2.C2D(-topThickness, -HB);
                Point2d ptICM5 = ptICM3.C2D(mw, -mH);
                Point2d ptICM6 = ptICM4.C2D(-mw, -mH);
                ptLst.Add(ptICM1);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM.C2D(-bw * 0.5));
                //ptLst.Add(ptICM6);
                //ptLst.Add(ptICM4);
                //ptLst.Add(ptICM2);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);

                ptLst = new List<Point2d>();
                ptLst.Add(ptICM.C2D(bw * 0.5));
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptICM2);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);

                Line lB1 = new Line(ptICM.C3D(-bw * 0.5, -pierPara.pierRebar.pier_block_protect_layer), ptICM.C3D(bw * 0.5, -pierPara.pierRebar.pier_block_protect_layer));
                Line lB2 = new Line(ptICM.C3D(-bw * 0.5, -bH + pierPara.pierRebar.pier_block_protect_layer), ptICM.C3D(bw * 0.5, -bH + pierPara.pierRebar.pier_block_protect_layer));
                #region 14#，10#
                double ang = Math.Atan(mw / mH);
                Line l1 = new Line(ptICM3.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICM5.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
                double lenLine = l1.Length;

                Line lOut1 = new Line(ptCM1.C3D(avg), ptCM1E.C3D(avg));
                Point3d ptOut = MathExtensions.GetIntersection(l1, lOut1);
                Line lOut = new Line(ptOut, l1.StartPoint);
                lenN9 = lOut.Length;
                Point3d p1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine + lenN9).C3D();
                Point3d p2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenN9).C3D();
                p1 = MathExtensions.GetIntersection(l1, lB2);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                Line lineN9 = new Line(p1.C3D(), p2.C3D());
                lenN9All = lineN9.Length;
                List<Point3d> ptALst = new List<Point3d>();
                for (int i = 1; i < 4; i++)
                {
                    double lenDiv = (lenLine - 2 * radius) * i / spancaLst.Count;
                    Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenDiv + radius).C3D(-radius * Math.Cos(ang), -radius * Math.Sin(ang));
                    ptALst.Add(pp1);
                }
                SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);
                Point3d ptN9 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenLine * 0.2).C3D();
                RebarDimPloter.CreateHookLineMark(db, ref ext, ptN9, "14", 3 * scale, scale, GeTools.RadianToDegree(ang));
                RebarDimPloter.CreateHookLineMark(db, ref ext, ptALst[0], ptALst, "10a", 3 * scale, scale, 360 - GeTools.RadianToDegree(ang));

                Line l2 = new Line(ptICM6.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICM4.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
                double lenLine2 = l2.Length;

                p1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenLine + lenN9).C3D();
                p2 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), -lenN9).C3D();
                p2 = MathExtensions.GetIntersection(l2, lB2);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                ptALst = new List<Point3d>();
                for (int i = 1; i < 4; i++)
                {
                    double lenDiv = (lenLine2 - 2 * radius) * i / spancaLst.Count;
                    Point3d pp1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenDiv + radius).C3D(radius * Math.Cos(ang), -radius * Math.Sin(ang));
                    ptALst.Add(pp1);
                }
                SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);
                #endregion


                #region 隔板
                PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(bw * 0.5), ref ext, "H虚线");
                PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(-bw * 0.5, -bH), ref ext, "H细线");
                PLPloter.AddLine(db,ptICM.C2D(bw * 0.5), ptICM.C2D(bw * 0.5, -bH), ref ext, "H细线");
                PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5, -bH), ptICM.C2D(bw * 0.5, -bH), ref ext, "H虚线");
              
                // DimPloter.DimRadius(db, ptICM.C3D(-bw * 0.75), ptICM.C3D(-bw * 0.75, 0.01), 2 * scale, ref ext, scale, "净" + pierPara.pierRebar.concrete_protect_layer);
                DimPloter.DimRadiusExtend(db,ptICM.C3D(-bw * 0.75), ptICM.C3D(-bw * 0.75, 0.01), 2 * scale, ref ext, scale/extendscale, extendscale, "净" + pierPara.pierRebar.concrete_protect_layer);
                #region 12#
                ptLst = new List<Point2d>();
                ptLst.Add(ptICM.C2D(-lenW * 0.5, -bH + pierPara.pierRebar.pier_block_protect_layer));
                ptLst.Add(ptICM.C2D(-bw * 0.5 - pierPara.pierRebar.pier_block_protect_layer, -bH + pierPara.pierRebar.pier_block_protect_layer));
                ptLst.Add(ptICM.C2D(-bw * 0.5 - pierPara.pierRebar.pier_block_protect_layer, -pierPara.pierRebar.pier_block_protect_layer));
                ptLst.Add(ptICM.C2D(-lenW * 0.5, -pierPara.pierRebar.pier_block_protect_layer));
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H钢筋", false);

                ptLst = new List<Point2d>();
                ptLst.Add(ptICM.C2D(lenW * 0.5, -bH + pierPara.pierRebar.pier_block_protect_layer));
                ptLst.Add(ptICM.C2D(bw * 0.5 + pierPara.pierRebar.pier_block_protect_layer, -bH + pierPara.pierRebar.pier_block_protect_layer));
                ptLst.Add(ptICM.C2D(bw * 0.5 + pierPara.pierRebar.pier_block_protect_layer, -pierPara.pierRebar.pier_block_protect_layer));
                ptLst.Add(ptICM.C2D(lenW * 0.5, -pierPara.pierRebar.pier_block_protect_layer));
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H钢筋", false);
                #endregion

                #region  6#
                Point2d ptSt = ptICM.C2D(-bw * 0.5 - pierPara.pierRebar.pier_block_protect_layer, -pierPara.pierRebar.pier_block_protect_layer);
                List<Point3d> ptHLst = new List<Point3d>();
                List<double> ptHSLst = new List<double>();
                string spH = "";
                double le = lenW * 0.5 - bw * 0.5 - spaceLen - pierPara.pierRebar.pier_block_protect_layer;
                SteelBarPileCap.CreateCircleHatchListBySpace(db, ref ext, ptSt.C2D(0, -radius),
                  radius, le, pierPara.pierRebar.block_reinforcement_space, out ptHLst, out ptHSLst, out spH, eDirection.E_RIGHT);

                ptSt = ptICM.C2D(bw * 0.5 + pierPara.pierRebar.pier_block_protect_layer, -pierPara.pierRebar.pier_block_protect_layer);
                SteelBarPileCap.CreateCircleHatchListBySpace(db, ref ext, ptSt.C2D(0, -radius),
       radius, le, pierPara.pierRebar.block_reinforcement_space, out ptHLst, out ptHSLst, out spH, eDirection.E_LEFT);

                ptSt = ptICM.C2D(-bw * 0.5 - pierPara.pierRebar.pier_block_protect_layer, -bH + pierPara.pierRebar.pier_block_protect_layer);
                SteelBarPileCap.CreateCircleHatchListBySpace(db, ref ext, ptSt.C2D(0, radius),
                   radius, le, pierPara.pierRebar.block_reinforcement_space, out ptHLst, out ptHSLst, out spH, eDirection.E_RIGHT);

                ptSt = ptICM.C2D(bw * 0.5 + pierPara.pierRebar.pier_block_protect_layer, -bH + pierPara.pierRebar.pier_block_protect_layer);
                SteelBarPileCap.CreateCircleHatchListBySpace(db, ref ext, ptSt.C2D(0, radius),
       radius, le, pierPara.pierRebar.block_reinforcement_space, out ptHLst, out ptHSLst, out spH, eDirection.E_LEFT);
                #endregion

                RebarDimPloter.CreateHookLineMark(db, ref ext, ptSt.C3D(-bw - pierPara.pierRebar.pier_block_protect_layer * 2 - pierPara.pierRebar.block_reinforcement_space * 2.5), "12", 3 * scale, scale, 270);
                SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_TOP, ptHLst, "6", ptHLst.Count / 4, ptHLst.Count / 4, scale, false, 3.5 * scale);
                #endregion

                ptLst = new List<Point2d>();
                Point2d ptCMI1E = ptCF1.C2D(topThickness, -MH);
                Point2d ptCMI2E = ptCF2.C2D(-topThickness, -MH);
                ptICM3 = ptCF1.C2D(topThickness, -(HB + mH * 2 + bH));
                ptICM4 = ptCF2.C2D(-topThickness, -(HB + mH * 2 + bH));
                ptICM5 = ptICM3.C2D(mw, mH);
                ptICM6 = ptICM4.C2D(-mw, mH);
                ptLst.Add(ptCMI1E);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM.C2D(-bw * 0.5, -bH));

                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);
                ptLst = new List<Point2d>();
                ptLst.Add(ptICM.C2D(bw * 0.5, -bH));
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptCMI2E);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);
                #endregion

                #region 14#，10#      
                l1 = new Line(ptICM3.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICM5.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
                lenLine = l1.Length;


                lOut1 = new Line(ptCM1.C3D(avg), ptCM1E.C3D(avg));
                ptOut = MathExtensions.GetIntersection(l1, lOut1);
                lOut = new Line(ptOut, l1.StartPoint);
                double lenN91 = lOut.Length;


                p1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine + lenN91).C3D();
                p2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenN91).C3D();


                p1 = MathExtensions.GetIntersection(l1, lB1);

                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                Line lineN91 = new Line(p1.C3D(), p2.C3D());
                lenN9All = lineN91.Length;
                ptALst = new List<Point3d>();
                for (int i = 1; i < 4; i++)
                {
                    double lenDiv = (lenLine - 2 * radius) * i / spancaLst.Count;
                    Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenDiv + radius).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                    ptALst.Add(pp1);
                }
                SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);
                //ptN9 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenLine * 0.2).C3D();
                //RebarDimPloter.CreateHookLineMark(db, ref ext, ptN9, "9", 3 * scale, scale, 360 - GeTools.RadianToDegree(ang));
                //RebarDimPloter.CreateHookLineMark(db, ref ext, ptALst[0], ptALst, "10", 3 * scale, scale, 360 - GeTools.RadianToDegree(ang));

                l2 = new Line(ptICM6.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICM4.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
                lenLine2 = l2.Length;

                p1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenLine2 + lenN91).C3D();
                p2 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), -lenN91).C3D();

                p2 = MathExtensions.GetIntersection(l2, lB1);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                ptALst = new List<Point3d>();
                for (int i = 1; i < 4; i++)
                {
                    double lenDiv = (lenLine2 - 2 * radius) * i / spancaLst.Count;
                    Point3d pp1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenDiv + radius).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                    ptALst.Add(pp1);
                }
                SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);
                #endregion

                #endregion

            }
        }

        public void PlotPierBlockB(ref Database db, out Extents2d ext, Point2d insertPoint, double scale)
        {
            scale = scale * extendscale;
            ext = new Extents2d(insertPoint, insertPoint);
            if (BulkheadCount > 0)
            {
                TextPloter.AddTitle(db,insertPoint, ref ext, "横隔板钢筋布置侧面", "", scale);
                Point2d pt = insertPoint.C2D(0, -3 * scale);
                //double topH = pierPara.column.top_solid_h;
                //double botH = pierPara.column.bottom_solid_h;

                string[] sizeM = pierPara.column.section_mid_l_ang.Split('*');
                string[] sizeBulk = pierPara.column.bulkhead_size_l.Split('*');
                double mH = double.Parse(sizeM[1]);
                double mw = double.Parse(sizeM[0]);
                double bH = double.Parse(sizeBulk[1]);
                double bw = double.Parse(sizeBulk[0]);
                //string[] sizeBulkL = pierPara.column.bulkhead_size_l.Split('*');
                //double bwL = double.Parse(sizeBulkL[1]);
                #region 横隔板

                double MH = (mH + bH) * 4;
                double HB = (MH - mH * 2 - bH) * 0.5;
                Point2d ptCF1 = pt.C2D(-pierPara.column.top_l * 0.5 - pierPara.pier_height * 100 * 0.5 * pierPara.column.slope_l);
                Point2d ptCF2 = pt.C2D(pierPara.column.top_l * 0.5 + pierPara.pier_height * 100 * 0.5 * pierPara.column.slope_l);
                Point2d ptCM1 = ptCF1.C2D(0, 0);
                Point2d ptCM2 = ptCF2.C2D(0, 0);
                Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_l, -MH);
                Point2d ptCM2E = ptCF2.C2D((MH) * pierPara.column.slope_l, -MH);

                Point2d ptICM = pt.C2D(0, -HB - mH); ;
                Point2d ptICM1 = ptCF1.C2D(0, 0);
                Point2d ptICM2 = ptCF2.C2D(0, 0);


                #region 外轮廓
                ptCF1 = ptCF1.C2D();
                ptCF2 = ptCF2.C2D();
                ptCM1 = ptCF1.C2D(0, 0);
                ptCM2 = ptCF2.C2D(0);
                ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_l, -MH);
                ptCM2E = ptCF2.C2D((MH) * pierPara.column.slope_l, -MH);

                PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(-5 * scale), ptCM2.C2D(5 * scale), scale, "H细线");

                PLPloter.AddLine(db,ptCM1, ptCM1E, ref ext, "H细线");
                PLPloter.AddLine(db,ptCM2, ptCM2E, ref ext, "H细线");

                PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale), ptCM2E.C2D(5 * scale), scale, "H细线");

                #endregion
                List<Point2d> ptLst = new List<Point2d>();
                double lenL = Math.Round(spanclLst.Sum(), 1);
                double avg = (pierPara.column.top_l - lenL) * 0.5;
                double spaceLen = spancsLst.Sum();


                #region 钢筋

                Point2d ptSt = ptCM1.C2D(avg);
                double stL = pierPara.column.top_l * 0.5 * 2 - avg * 2 + pierPara.pier_height * 100 * pierPara.column.slope_l; ;
                List<Point2d> ptTLst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptSt, spancslLst, spancmlLst, lenL, stL, out ptTLst);
                Point2d ptEnd = ptCM1E.C2D(avg);
                double endL = pierPara.column.top_l * 0.5 * 2 - avg * 2 + (MH) * pierPara.column.slope_l * 2 + pierPara.pier_height * 100 * pierPara.column.slope_l;
                List<Point2d> ptBLst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptEnd, spancslLst, spancmlLst, lenL, endL, out ptBLst);

                Point2d ptStE = ptCM1.C2D(avg - HB * pierPara.column.slope_l, -HB);
                double stLE = stL + HB * pierPara.column.slope_l * 2;
                List<Point2d> ptTELst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptStE, spancslLst, spancmlLst, lenL, stLE, out ptTELst);
                Point2d ptEndS = ptCM1E.C2D(avg + HB * pierPara.column.slope_l, HB);
                double endLS = stL + (HB + mH) * pierPara.column.slope_l * 2;
                List<Point2d> ptBSLst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptEndS, spancslLst, spancmlLst, lenL, endLS, out ptBSLst);

                PLPloter.AddLine(db,ptSt, ptEnd, ref ext, "H钢筋");
                for (int m = 0; m < ptTLst.Count; m++)
                {
                    if (m == spancslLst.Count || m == spanclLst.Count - spancslLst.Count || m == spanclLst.Count)
                        PLPloter.AddLine(db,ptTLst[m], ptBLst[m], ref ext, "H钢筋");
                }

                int numR = (int)((MH - 10) / pierPara.pierRebar.middle_encryption_spacing);
                double lenH = 0;
                for (int m = 1; m <= numR - 1; m++)
                {
                    lenH += pierPara.pierRebar.middle_encryption_spacing;

                    Point2d ptV1 = ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                    double vL = endL - lenH * pierPara.column.slope_l * 2;
                    List<Point2d> ptVLst = new List<Point2d>();
                    RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);

                    PLPloter.AddLine(db,ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                    PLPloter.AddLine(db,ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                }


                #endregion


                #region 内轮廓
                Line lB1 = new Line(ptICM.C3D(-bw * 0.5, -pierPara.pierRebar.pier_block_protect_layer), ptICM.C3D(bw * 0.5, -pierPara.pierRebar.pier_block_protect_layer));
                Line lB2 = new Line(ptICM.C3D(-bw * 0.5, -bH + pierPara.pierRebar.pier_block_protect_layer), ptICM.C3D(bw * 0.5, -bH + pierPara.pierRebar.pier_block_protect_layer));

                ptLst = new List<Point2d>();
                ptICM1 = ptTLst[spancslLst.Count].C2D(pierPara.pierRebar.concrete_protect_layer);
                ptICM2 = ptTLst[spanclLst.Count - spancslLst.Count].C2D(-pierPara.pierRebar.concrete_protect_layer);
                Point2d ptICM3 = ptTELst[spancslLst.Count].C2D(pierPara.pierRebar.concrete_protect_layer);
                Point2d ptICM4 = ptTELst[spanclLst.Count - spancslLst.Count].C2D(-pierPara.pierRebar.concrete_protect_layer);
                Point2d ptICM5 = ptICM3.C2D(mw, -mH);
                Point2d ptICM6 = ptICM4.C2D(-mw, -mH);

                ptLst.Add(ptICM1);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM.C2D(-bw * 0.5));
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);

                #region 14#，10#
                double ang = Math.Atan(mw / mH);
                Line l1 = new Line(ptICM3.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICM5.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
                double lenLine = l1.Length;

                //Line lOut1 = new Line(ptCM1.C3D(avg), ptCM1E.C3D(avg));
                //Point3d ptOut = MathExtensions.GetIntersection(l1, lOut1);
                //Line lOut = new Line(ptOut, l1.StartPoint);
                //lenN9 = lOut.Length;

                Point3d p1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine + lenN9).C3D();
                Point3d p2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenN9).C3D();
                p1 = MathExtensions.GetIntersection(l1, lB2);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                List<Point3d> ptALst = new List<Point3d>();
                for (int i = 1; i < 4; i++)
                {
                    double lenDiv = (lenLine - 2 * radius) * i / spancaLst.Count;
                    Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenDiv + radius).C3D(-radius * Math.Cos(ang), -radius * Math.Sin(ang));
                    ptALst.Add(pp1);
                }
                SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);
                Point3d ptN9 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenLine * 0.2).C3D();
                RebarDimPloter.CreateHookLineMark(db, ref ext, ptN9, "14", 3 * scale, scale, GeTools.RadianToDegree(ang));
                RebarDimPloter.CreateHookLineMark(db, ref ext, ptALst[0], ptALst, "10", 3 * scale, scale, 360 - GeTools.RadianToDegree(ang));

                Line l2 = new Line(ptICM6.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICM4.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
                double lenLine2 = l2.Length;

                p1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenLine + lenN9).C3D();
                //p2 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), -lenN9).C3D();
                p2 = MathExtensions.GetIntersection(l2, lB2);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                ptALst = new List<Point3d>();
                for (int i = 1; i < 4; i++)
                {
                    double lenDiv = (lenLine2 - 2 * radius) * i / spancaLst.Count;
                    Point3d pp1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenDiv + radius).C3D(radius * Math.Cos(ang), -radius * Math.Sin(ang));
                    ptALst.Add(pp1);
                }
                SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);
                #endregion

                ptLst = new List<Point2d>();
                ptLst.Add(ptICM.C2D(bw * 0.5));
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptICM2);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);

                #region 隔板
                PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(bw * 0.5), ref ext, "H虚线");
                PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(-bw * 0.5, -bH), ref ext, "H细线");
                PLPloter.AddLine(db,ptICM.C2D(bw * 0.5), ptICM.C2D(bw * 0.5, -bH), ref ext, "H细线");
                PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5, -bH), ptICM.C2D(bw * 0.5, -bH), ref ext, "H虚线");

                #region 13#
                ptLst = new List<Point2d>();
                double lenW = pierPara.column.top_l - avg * 2 + (HB + bH - pierPara.pierRebar.pier_block_protect_layer) * pierPara.column.slope_l * 2;
                ptLst.Add(ptICM.C2D(-lenW * 0.5, -bH + pierPara.pierRebar.pier_block_protect_layer));
                ptLst.Add(ptICM.C2D(-bw * 0.5 - pierPara.pierRebar.pier_block_protect_layer, -bH + pierPara.pierRebar.pier_block_protect_layer));
                ptLst.Add(ptICM.C2D(-bw * 0.5 - pierPara.pierRebar.pier_block_protect_layer, -pierPara.pierRebar.pier_block_protect_layer));
                lenW = pierPara.column.top_l - avg * 2 + (HB + pierPara.pierRebar.pier_block_protect_layer) * pierPara.column.slope_l * 2;
                ptLst.Add(ptICM.C2D(-lenW * 0.5, -pierPara.pierRebar.pier_block_protect_layer));
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H钢筋", false);

                ptLst = new List<Point2d>();
                lenW = pierPara.column.top_l - avg * 2 + (HB + bH - pierPara.pierRebar.pier_block_protect_layer) * pierPara.column.slope_l * 2;
                ptLst.Add(ptICM.C2D(lenW * 0.5, -bH + pierPara.pierRebar.pier_block_protect_layer));
                ptLst.Add(ptICM.C2D(bw * 0.5 + pierPara.pierRebar.pier_block_protect_layer, -bH + pierPara.pierRebar.pier_block_protect_layer));
                ptLst.Add(ptICM.C2D(bw * 0.5 + pierPara.pierRebar.pier_block_protect_layer, -pierPara.pierRebar.pier_block_protect_layer));
                lenW = pierPara.column.top_l - avg * 2 + (HB + pierPara.pierRebar.pier_block_protect_layer) * pierPara.column.slope_l * 2;
                ptLst.Add(ptICM.C2D(lenW * 0.5, -pierPara.pierRebar.pier_block_protect_layer));
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H钢筋", false);


                #endregion

                #region  6a#
                Point2d ptStN7 = ptICM.C2D(-bw * 0.5 - pierPara.pierRebar.pier_block_protect_layer, -pierPara.pierRebar.pier_block_protect_layer);
                List<Point3d> ptHLst = new List<Point3d>();
                List<double> ptHSLst = new List<double>();
                string spH = "";
                double le = lenW * 0.5 - bw * 0.5 - spaceLen - pierPara.pierRebar.pier_block_protect_layer;
                SteelBarPileCap.CreateCircleHatchListBySpace(db, ref ext, ptStN7.C2D(0, -radius),
                  radius, le, pierPara.pierRebar.block_reinforcement_space, out ptHLst, out ptHSLst, out spH, eDirection.E_RIGHT);

                ptStN7 = ptICM.C2D(bw * 0.5 + pierPara.pierRebar.pier_block_protect_layer, -pierPara.pierRebar.pier_block_protect_layer);
                SteelBarPileCap.CreateCircleHatchListBySpace(db, ref ext, ptStN7.C2D(0, -radius),
       radius, le, pierPara.pierRebar.block_reinforcement_space, out ptHLst, out ptHSLst, out spH, eDirection.E_LEFT);

                ptStN7 = ptICM.C2D(-bw * 0.5 - pierPara.pierRebar.pier_block_protect_layer, -bH + pierPara.pierRebar.pier_block_protect_layer);
                SteelBarPileCap.CreateCircleHatchListBySpace(db, ref ext, ptStN7.C2D(0, radius),
                   radius, le, pierPara.pierRebar.block_reinforcement_space, out ptHLst, out ptHSLst, out spH, eDirection.E_RIGHT);

                ptStN7 = ptICM.C2D(bw * 0.5 + pierPara.pierRebar.pier_block_protect_layer, -bH + pierPara.pierRebar.pier_block_protect_layer);
                SteelBarPileCap.CreateCircleHatchListBySpace(db, ref ext, ptStN7.C2D(0, radius),
       radius, le, pierPara.pierRebar.block_reinforcement_space, out ptHLst, out ptHSLst, out spH, eDirection.E_LEFT);
                #endregion

                RebarDimPloter.CreateHookLineMark(db, ref ext, ptStN7.C3D(-bw - pierPara.pierRebar.pier_block_protect_layer * 2 - pierPara.pierRebar.block_reinforcement_space * 2.5), "13", 3 * scale, scale, 270);
                if (ptHLst.Count > 6)
                    SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_TOP, ptHLst, "6a", ptHLst.Count / 4, ptHLst.Count / 4, scale, false, 4 * scale);
                else
                    RebarDimPloter.CreateNewHookLineMark(db, ref ext, ptHLst[ptHLst.Count - 1].C3D(0, -3 * scale), ptHLst, "6a", scale, false, false);
                #endregion

                ptLst = new List<Point2d>();
                Point2d ptCMI1E = ptBLst[spancslLst.Count].C2D(pierPara.pierRebar.concrete_protect_layer);
                Point2d ptCMI2E = ptBLst[spanclLst.Count - spancslLst.Count].C2D(-pierPara.pierRebar.concrete_protect_layer);
                ptICM3 = ptBSLst[spancslLst.Count].C2D(pierPara.pierRebar.concrete_protect_layer);
                ptICM4 = ptBSLst[spanclLst.Count - spancslLst.Count].C2D(-pierPara.pierRebar.concrete_protect_layer);
                ptICM5 = ptICM3.C2D(mw, mH);
                ptICM6 = ptICM4.C2D(-mw, mH);

                ptLst.Add(ptCMI1E);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM.C2D(-bw * 0.5, -bH));

                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);



                ptLst = new List<Point2d>();
                ptLst.Add(ptICM.C2D(bw * 0.5, -bH));
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptCMI2E);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);


                #region 9#，10#      
                l1 = new Line(ptICM3.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICM5.C3D(-pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
                lenLine = l1.Length;

                //lOut1 = new Line(ptCM1.C3D(avg), ptCM1E.C3D(avg));
                //ptOut = MathExtensions.GetIntersection(l1, lOut1);
                //lOut = new Line(ptOut, l1.StartPoint);
                //lenN9 = lOut.Length;
                p1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine + lenN9).C3D();
                p2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenN9).C3D();
                p1 = MathExtensions.GetIntersection(l1, lB1);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                ptALst = new List<Point3d>();
                for (int i = 1; i < 4; i++)
                {
                    double lenDiv = (lenLine - 2 * radius) * i / spancaLst.Count;
                    Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenDiv + radius).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                    ptALst.Add(pp1);
                }
                SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);
                //ptN9 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenLine * 0.2).C3D();
                //RebarDimPloter.CreateHookLineMark(db, ref ext, ptN9, "9", 3 * scale, scale, 360 - GeTools.RadianToDegree(ang));
                //RebarDimPloter.CreateHookLineMark(db, ref ext, ptALst[0], ptALst, "10", 3 * scale, scale, 360 - GeTools.RadianToDegree(ang));

                l2 = new Line(ptICM6.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)), ptICM4.C3D(pierPara.pierRebar.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebar.concrete_protect_layer * Math.Sin(ang)));
                lenLine2 = l2.Length;

                p1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenLine + lenN9).C3D();
                p2 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), -lenN9).C3D();
                p2 = MathExtensions.GetIntersection(l2, lB1);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                ptALst = new List<Point3d>();
                for (int i = 1; i < 4; i++)
                {
                    double lenDiv = (lenLine2 - 2 * radius) * i / spancaLst.Count;
                    Point3d pp1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenDiv + radius).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                    ptALst.Add(pp1);
                }
                SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);
                #endregion

                #endregion


                #endregion
            }
        }
        public void PlotPierBlockPlan(ref Database db, out Extents2d ext, Point2d insertPoint, double scale)
        {
            scale = scale * extendscale;
            ext = new Extents2d(insertPoint, insertPoint);
            if (BulkheadCount > 0)
            {
                TextPloter.AddTitle(db,insertPoint, ref ext, "横隔板钢筋布置平面", "", scale);
                Point2d pt = insertPoint.C2D(0, -15 * scale);

                double W = pierPara.column.top_w;
                double L = pierPara.column.top_l;
                if (pierPara.column.slope_w > 0)
                    W = W + 120;
                if (pierPara.column.slope_l > 0)
                    L = L + 120;

                string[] sizeBulk = pierPara.column.bulkhead_size_w.Split('*');
                string[] sizeBulkL = pierPara.column.bulkhead_size_l.Split('*');
                //double bH = double.Parse(sizeBulk[1]);
                double bw = double.Parse(sizeBulk[0]);
                double bwL = double.Parse(sizeBulkL[0]);
                double lenW = Math.Round(spancwLst.Sum(), 1);
                double avg = (pierPara.column.top_w - lenW) * 0.5;
                double lenL = Math.Round(spanclLst.Sum(), 1);
                double avgl = (pierPara.column.top_l - lenL) * 0.5;


                string[] sizeOut = pierPara.column.out_section_ang.Split('*');
                string[] sizeInner = pierPara.column.inner_section_ang.Split('*');
                double outW = double.Parse(sizeOut[0]);
                double outL = double.Parse(sizeOut[1]);
                double innerW = double.Parse(sizeInner[0]);
                double innerL = double.Parse(sizeInner[1]);
                ObjectId pLId1 = PLPloter.CreatPoly8(db, pt.C2D(), ref ext, L, W, "H细线", outL, outW, outL, outW);

                Point2d ptCenter = pt.C2D(0, -L * 0.5);
                ObjectId pLId2 = PLPloter.CreatPoly8(db, ptCenter.C2D(0, bwL * 0.5), ref ext, bwL, bw, "H细线", 10, 10, 10, 10);

                double spaceLen = spancsLst.Sum();
                double spaceLLen = spancslLst.Sum();
                List<double> wSPLst = new List<double>();
                string wString = "";
                double soldW = (W - avg * 2 - 2 * spaceLen - bwL - 2 * pierPara.pierRebar.pier_block_protect_layer) * 0.5;
                RebarArrangement.ArrangeSpaceOneSide(soldW, pierPara.pierRebar.block_reinforcement_space, out wSPLst, out wString, true);

                List<double> wSPLst1 = new List<double>();
                string wString1 = "";
                RebarArrangement.ArrangeSpaceOneSide(soldW, pierPara.pierRebar.block_reinforcement_space, out wSPLst1, out wString1, false);

                List<double> lSPLst = new List<double>();
                string lString = "";
                double soldL = (L - avgl * 2 - 2 * spaceLLen - bwL - 2 * pierPara.pierRebar.pier_block_protect_layer) * 0.5;
                RebarArrangement.ArrangeBySpace(soldL, pierPara.pierRebar.block_reinforcement_space, out lSPLst, out lString);


                List<double> lSPLst1 = new List<double>();
                string lString1 = "";
                RebarArrangement.ArrangeBySpace(soldL, pierPara.pierRebar.block_reinforcement_space, out lSPLst1, out lString1);

                List<Point3d> reLst1 = new List<Point3d>();
                List<Point3d> reLst = new List<Point3d>();
                List<double> lstDimSp = new List<double>();
                SteelBarPileCap.CreateBatchLineNew(db, ref ext, pt.C2D(-(bw * 0.5 + pierPara.pierRebar.pier_block_protect_layer) - wSPLst.Sum(), -L + avgl), wSPLst, L - avgl * 2, out reLst, out lstDimSp, false);
                SteelBarPileCap.CreateBatchLineNew(db, ref ext, pt.C2D(bw * 0.5 + pierPara.pierRebar.pier_block_protect_layer, -L + avgl), wSPLst1, L - avgl * 2, out reLst1, out lstDimSp, false);

                List<Point3d> reLLst1 = new List<Point3d>();
                List<Point3d> reLLst = new List<Point3d>();
                List<double> lstDimLSp = new List<double>();
                SteelBarPileCap.CreateBatchLineNew(db, ref ext, pt.C2D(-W * 0.5 + avg, -L * 0.5 + pierPara.pierRebar.pier_block_protect_layer + bwL * 0.5), lSPLst1, W - avg * 2, out reLLst1, out lstDimLSp, true);
                SteelBarPileCap.CreateBatchLineNew(db, ref ext, pt.C2D(-W * 0.5 + avg, -L * 0.5 - pierPara.pierRebar.pier_block_protect_layer - bwL * 0.5 - lSPLst.Sum()), lSPLst, W - avg * 2, out reLLst, out lstDimLSp, true);

                List<double> lLst = new List<double>();
                for (int i = 0; i < lSPLst.Count; i++)
                {
                    lLst.Add(lSPLst[i]);
                }
                lLst.Add(bwL + pierPara.pierRebar.pier_block_protect_layer * 2);
                for (int i = 0; i < lSPLst1.Count; i++)
                {
                    lLst.Add(lSPLst1[i]);
                }
                RebarPLPloter.CreateLineArrowDBNew(db, ref ext, reLLst1[reLLst1.Count - 1].C3D(W - spaceLen*0.9), ArrowDirection.North, lLst, new List<double>(), "6a", scale, true, 7, 0 * scale);
                List<double> wLst = new List<double>();
                for (int i = 0; i < wSPLst.Count; i++)
                {
                    wLst.Add(wSPLst[i]);
                }
                wLst.Add(bw + pierPara.pierRebar.pier_block_protect_layer * 2);
                for (int i = 0; i < wSPLst1.Count; i++)
                {
                    wLst.Add(wSPLst1[i]);
                }
                RebarPLPloter.CreateLineArrowDBNew(db, ref ext, reLst[0].C3D(0, L - spaceLLen), ArrowDirection.West, new List<double>(), wLst, "6", scale, true, 5, 0 * scale);


                List<double> wMPLst = new List<double>();
                string wMString = "";
                RebarArrangement.ArrangeSpaceBothNull(bw, pierPara.pierRebar.block_reinforcement_space, out wMPLst, out wMString);

                List<double> lMPLst = new List<double>();
                string lMString = "";
                RebarArrangement.ArrangeSpaceBothNull(bwL, pierPara.pierRebar.block_reinforcement_space, out lMPLst, out lMString);

                List<Point3d> rewLst = new List<Point3d>();
                List<Point3d> rewLst1 = new List<Point3d>();
                List<double> lstDimwSp = new List<double>();
                SteelBarPileCap.CreateBatchLineNew(db, ref ext, pt.C2D(-wMPLst.Sum() * 0.5, -L * 0.5 + bwL * 0.5 + pierPara.pierRebar.pier_block_protect_layer), wMPLst, (L - avgl * 2 - bwL - 2 * pierPara.pierRebar.pier_block_protect_layer) * 0.5, out rewLst, out lstDimwSp, false);
                SteelBarPileCap.CreateBatchLineNew(db, ref ext, pt.C2D(-wMPLst.Sum() * 0.5, -L + avgl), wMPLst, (L - avgl * 2 - bwL - 2 * pierPara.pierRebar.pier_block_protect_layer) * 0.5, out rewLst1, out lstDimwSp, false);
                RebarPLPloter.CreateLineArrowDBNew(db, ref ext, rewLst1[0].C3D(0, spaceLLen * 0.5), ArrowDirection.West, new List<double>(), wMPLst, "13", scale, true, 33, 2 * scale);

                List<Point3d> relLst = new List<Point3d>();
                List<Point3d> relLst1 = new List<Point3d>();
                List<double> lstDimlSp = new List<double>();

                SteelBarPileCap.CreateBatchLineNew(db, ref ext, pt.C2D(-W * 0.5 + avg, -L * 0.5 - lMPLst.Sum() * 0.5), lMPLst, (W - avg * 2 - bw - 2 * pierPara.pierRebar.pier_block_protect_layer) * 0.5, out relLst, out lstDimlSp, true);
                SteelBarPileCap.CreateBatchLineNew(db, ref ext, pt.C2D(bw * 0.5 + pierPara.pierRebar.pier_block_protect_layer, -L * 0.5 - lMPLst.Sum() * 0.5), lMPLst, (W - avg * 2 - bw - 2 * pierPara.pierRebar.pier_block_protect_layer) * 0.5, out relLst1, out lstDimlSp, true);
                RebarPLPloter.CreateLineArrowDBNew(db, ref ext, relLst[relLst.Count - 1].C3D(spaceLen * 0.45), ArrowDirection.North, lMPLst, new List<double>(), "12", scale, true, 23, 3 * scale);

                double avw = (bw + 2 * pierPara.pierRebar.pier_block_protect_layer - wMPLst.Sum()) * 0.5;
                string v = avw + "+" + wMString + "+" + avw;
                #region 标注
                //DimPloter.DimRot(db, reLst[0].C3D(), reLst[reLst.Count - 1].C3D(), pt.C3D(0, 5 * scale), ref ext, 0, scale, wString, Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, reLst[reLst.Count - 1].C3D(), reLst1[0].C3D(), pt.C3D(0, 9 * scale), ref ext, 0, scale, v, Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, reLst1[0].C3D(), reLst1[reLst1.Count - 1].C3D(), pt.C3D(0, 5 * scale), ref ext, 0, scale, wString1, Unit.Centimeter, Unit.Centimeter);
                #endregion

                #region 标注
                DimPloter.DimRotExtend(db, reLst[0].C3D(), reLst[reLst.Count - 1].C3D(), pt.C3D(0, 5 * scale), ref ext, 0, scale/extendscale, extendscale, wString, Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRotExtend(db, reLst[reLst.Count - 1].C3D(), reLst1[0].C3D(), pt.C3D(0, 9 * scale), ref ext, 0, scale / extendscale, extendscale, v, Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRotExtend(db, reLst1[0].C3D(), reLst1[reLst1.Count - 1].C3D(), pt.C3D(0, 5 * scale), ref ext, 0, scale / extendscale, extendscale, wString1, Unit.Centimeter, Unit.Centimeter);
                #endregion

                double avl = (bwL + 2 * pierPara.pierRebar.pier_block_protect_layer - lMPLst.Sum()) * 0.5;
                string vl = avl + "+" + lMString + "+" + avl;
                //DimPloter.DimRot(db, reLLst[0].C3D(), reLLst1[reLLst1.Count - 1].C3D(), pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale, "m×" + pierPara.pierRebar.block_reinforcement_space, Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRotExtend(db, reLLst[0].C3D(), reLLst1[reLLst1.Count - 1].C3D(), pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale / extendscale, extendscale, "m×" + pierPara.pierRebar.block_reinforcement_space, Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, reLLst1[0].C3D(), reLLst1[reLLst1.Count - 1].C3D(), pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale, "n×" + pierPara.pierRebar.block_reinforcement_space, Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, reLLst[reLLst.Count - 1].C3D(), reLLst1[0].C3D(), pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, vl, Unit.Centimeter, Unit.Centimeter);
                double le1 = pierPara.pierRebar.pier_block_protect_layer * Math.Sin(GeTools.DegreeToRadian(45));
                //PLPloter.AddLine(db,pt.C2D(-bw * 0.5 - le1 - bwL * 0.5 - bwL * 0.5, -L * 0.5 - le1 - bwL * 0.5), pt.C2D(bwL * 0.5, -L * 0.5 + bwL * 0.5 + bw * 0.5 + le1 + bwL * 0.5), ref ext, "H钢筋");
                //PLPloter.AddLine(db,pt.C2D(bw * 0.5 + le1 + bwL * 0.5 + bwL * 0.5, -L * 0.5 - le1 - bwL * 0.5), pt.C2D(-bwL * 0.5, -L * 0.5 + bwL * 0.5 + le1 + bw * 0.5 + bwL * 0.5), ref ext, "H钢筋");

                //PLPloter.AddLine(db,pt.C2D(-bw * 0.5 - le1 - bwL * 0.5 - bwL * 0.5, -L * 0.5 + le1 + bwL * 0.5), pt.C2D(bwL * 0.5, -L * 0.5 - bwL * 0.5 - bw * 0.5 - le1 - bwL * 0.5), ref ext, "H钢筋");
                //PLPloter.AddLine(db,pt.C2D(bw * 0.5 + le1 + bwL * 0.5 + bwL * 0.5, -L * 0.5 + le1 + bwL * 0.5), pt.C2D(-bwL * 0.5, -L * 0.5 - bwL * 0.5 - bw * 0.5 - le1 - bwL * 0.5), ref ext, "H钢筋");
                double lenN11 = Math.Sqrt(Math.Pow(innerW, 2) + Math.Pow(innerL, 2));
                //double ang = Math.Tan(innerL / innerW);
                double add = 0.1*35 * (int)pierPara.pierRebar.pier_block_reinforcement_diameter;
                double w11 = add * Math.Sin(GeTools.DegreeToRadian(45));
                double l11 = add * Math.Sin(GeTools.DegreeToRadian(45));
                lenN11L = Math.Round(lenN11 + add * 2,1);
                PLPloter.AddLine(db,pt.C2D(-bw * 0.5+10 - le1+ w11, -L * 0.5+bwL*0.5 + le1+l11), pt.C2D(-bw * 0.5-le1-w11, -L * 0.5 + bwL * 0.5- 10 +le1 -l11), ref ext, "H钢筋");
                PLPloter.AddLine(db,pt.C2D(bw * 0.5 - 10 + le1 - w11, -L * 0.5 + bwL * 0.5 + le1 + l11), pt.C2D(bw * 0.5 + le1 + w11, -L * 0.5 + bwL * 0.5 - 10 +le1 - l11), ref ext, "H钢筋");
                //PLPloter.AddLine(db,pt.C2D(bw * 0.5 + le1 + bwL * 0.5 + bwL * 0.5, -L * 0.5 - le1 - bwL * 0.5), pt.C2D(-bwL * 0.5, -L * 0.5 + bwL * 0.5 + le1 + bw * 0.5 + bwL * 0.5), ref ext, "H钢筋");

                PLPloter.AddLine(db,pt.C2D(-bw * 0.5 + 10 - le1 + w11, -L * 0.5 - bwL * 0.5 - le1 - l11), pt.C2D(-bw * 0.5 - le1 - w11, -L * 0.5 - bwL * 0.5 + 10 - le1 + l11), ref ext, "H钢筋");
                PLPloter.AddLine(db,pt.C2D(bw * 0.5 - 10 + le1 - w11, -L * 0.5 - bwL * 0.5 - le1 - l11), pt.C2D(bw * 0.5 + le1 + w11, -L * 0.5 - bwL * 0.5 + 10 - le1 + l11), ref ext, "H钢筋");
                //PLPloter.AddLine(db,pt.C2D(-bw * 0.5 - le1 - bwL * 0.5 - bwL * 0.5, -L * 0.5 + le1 + bwL * 0.5), pt.C2D(bwL * 0.5, -L * 0.5 - bwL * 0.5 - bw * 0.5 - le1 - bwL * 0.5), ref ext, "H钢筋");
                //PLPloter.AddLine(db,pt.C2D(bw * 0.5 + le1 + bwL * 0.5 + bwL * 0.5, -L * 0.5 + le1 + bwL * 0.5), pt.C2D(-bwL * 0.5, -L * 0.5 - bwL * 0.5 - bw * 0.5 - le1 - bwL * 0.5), ref ext, "H钢筋");
                Point3d ptN11 = GeTools.MidPoint(pt.C3D(-bw * 0.5 - le1 - bwL * 0.5 - bwL * 0.5, -L * 0.5 - le1 - bwL * 0.5), pt.C3D(bwL * 0.5, -L * 0.5 + bwL * 0.5 + bw * 0.5 + le1 + bwL * 0.5));
                RebarDimPloter.CreateHookLineMark(db, ref ext, ptN11, "11", 3.5 * scale, scale, 315);
            }
        }

        #endregion

        #region 大样和算量计算
        public  void PlotPierSample(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            List<Tuple<string, eDB, int,double, string>> rebarLst = new List<Tuple<string, eDB, int, double, string>>();

            ext = new Extents2d(insertPoint, insertPoint);
          
            Point2d pt = insertPoint.C2D(135 * scale, -3*scale);
            TextPloter.AddTitle(db,pt.C2D(0,2*scale), ref ext, "N2钢筋示意", "", scale);

            double h2 = 40 * scale, w2 = 5 * scale;
            PLPloter.AddLine(db,pt.C2D(5*scale,0), pt.C2D(-5 * scale,-h2 ), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt.C2D(w2+15 * scale, -h2), pt.C2D(-w2 - 3 * scale, -h2 ), ref ext, "H细线");
            TextPloter.AddDBText(db,pt.C3D(w2+2 * scale, -h2), ref ext, "承台顶面", scale, 2.5, "SRB.HT", 0);
            Line l1 = new Line(pt.C3D(w2, 0), pt.C3D(-w2, -h2));

            double ang = GeTools.AngleFromXAxis(pt.C3D(w2, 0), pt.C3D(-w2, -h2));
            for (int i=0;i<5;i++)
            {
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), l1.Length*i/5).C3D();
                PLPloter.AddLine(db,pt.C2D(w2 - i * (w2*0.4), -h2), pp1.C2D(), ref ext, "H钢筋");
            }
            Point3d ptN1a = GeTools.MidPoint(pt.C3D(w2, 0), pt.C3D(-w2, -h2));
            RebarDimPloter.CreateHookLineMark(db, ref ext, ptN1a.C3D(), "1a", 2 * scale, scale,90+ GeTools.RadianToDegree(ang));
            RebarDimPloter.CreateHookLineMark(db, ref ext, pt.C3D(w2, -h2*0.5), "1b", 2 * scale, scale, 0);
            List<double> iLst = new List<double>();
            iLst.Add(w2 * 0.4);
            iLst.Add(w2 * 0.4);
            iLst.Add(w2 * 0.4);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, pt.C3D(-w2 + w2 * 0.4, -h2 +6*scale), ArrowDirection.West, new List<double>(), iLst, "2", scale, true, 5, 0 * scale);


            Point3d ptN1 = GeTools.DivPoint(pt.C3D(w2, 0), pt.C3D(-w2, -h2),3,false);
            string angS = "1:" + 1 / (pierPara.column.slope_l);
            TextPloter.AddDBText(db,ptN1, ref ext, angS, scale, 2.5, "SRB.HT", ang);


            double diaN1 = (GeneralRebar.outerDiaNew[pierPara.pierRebar.main_reinforcement_diameter] * 0.1);
            double diaN1Inner = (GeneralRebar.outerDiaNew[pierPara.pierRebar.inner_main_reinforcement_diameter] * 0.1);
            double diaN45 = (GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_stirrup_reinforcement_diameter] * 0.1);
            #region N1
            Point2d PtN1 = insertPoint.C2D(-20 * scale);
            RebarPLPloter.CreateBreakLine(db, ref ext, PtN1, PtN1.C2D(0,-220*scale), scale, "H钢筋");

            string noS = strMainDiameter + ((int)pierPara.pierRebar.main_reinforcement_diameter).ToString();
            string valueS = ("H+" + (pierPara.pierRebar.pilecap_penetration_depth + pierPara.pierRebar.beam_penetration_depth).ToString("0.0"));
            Point3d midC = GeTools.MidPoint(PtN1.C3D(), PtN1.C3D(0, -220 * scale));
            //if (pierPara.pierRebar.main_reinforcement_grade == "HRB650E")
            //{
            //    RebarDimPloter.RebarWire650(db, ref ext, midC.C2D(0, 10 * scale), midC.C2D(2 * scale, 10 * scale + 5 * scale), noS, valueS, "1", strMainDiameter,
            //GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            //}
            //else
            //{
                RebarDimPloter.RebarWireNew(db, ref ext, midC.C2D(0, 10 * scale), midC.C2D(2*scale, 15 * scale), noS, valueS, "1",
         GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            //}

            //TextPloter.AddDBText(db,midC.C3D(0,-10*scale), ref ext, angS, scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90));
            int N1 = spancwLst.Count * 2 + (spancwLst.Count - spancsLst.Count*2) * 2;
            Tuple<string, eDB, int, double,string> tu = new Tuple<string, eDB, int, double, string>("1", pierPara.pierRebar.main_reinforcement_diameter, N1, (pierPara.pierRebar.pilecap_penetration_depth + pierPara.pierRebar.beam_penetration_depth), valueS);
            rebarLst.Add(tu);

            Point2d PtN1a = insertPoint.C2D(0 * scale);
            RebarPLPloter.CreateBreakLine(db, ref ext, PtN1a, PtN1a.C2D(0, -220 * scale), scale, "H钢筋");       
            midC = GeTools.MidPoint(PtN1a.C3D(), PtN1a.C3D(0, -220 * scale));
    //        if (pierPara.pierRebar.main_reinforcement_grade == "HRB650E")
    //        {
    //            RebarDimPloter.RebarWire650(db, ref ext, midC.C2D(0, 10 * scale), midC.C2D(2 * scale, 10 * scale + 5 * scale), noS, valueS, "1a",strMainDiameter,
    //GeTools.DegreeToRadian(0), Extensions.curFont, scale);
    //        }
    //        else
    //        {
                RebarDimPloter.RebarWireNew(db, ref ext, midC.C2D(0, 10 * scale), midC.C2D(3*scale, 15 * scale), noS, valueS, "1a",
 GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            //}
            //TextPloter.AddDBText(db,midC.C3D(0, -10 * scale), ref ext, angS, scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90));

            Point2d PtN1b = insertPoint.C2D(20 * scale);
            RebarPLPloter.CreateBreakLine(db, ref ext, PtN1b, PtN1b.C2D(0, -220 * scale), scale, "H钢筋");
            midC = GeTools.MidPoint(PtN1b.C3D(), PtN1b.C3D(0, -220 * scale));
            //if (pierPara.pierRebar.main_reinforcement_grade == "HRB650E")
            //{
            //    RebarDimPloter.RebarWire650(db, ref ext, midC.C2D(0, 10 * scale), midC.C2D(2 * scale, 10 * scale + 5 * scale), noS, valueS, "1b",strMainDiameter,
            //GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            //}
            //else
            //{
                RebarDimPloter.RebarWireNew(db, ref ext, midC.C2D(0, 10 * scale), noS, valueS, "1b",
       GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            //}
            int N1a = spancslLst.Count * 2;
            tu = new Tuple<string, eDB, int, double, string>("1a", pierPara.pierRebar.main_reinforcement_diameter, N1a, (pierPara.pierRebar.pilecap_penetration_depth + pierPara.pierRebar.beam_penetration_depth), valueS);
            rebarLst.Add(tu);

            int N1b = spancmlLst.Count * 2 ;
            tu = new Tuple<string, eDB, int, double, string>("1b", pierPara.pierRebar.main_reinforcement_diameter, N1b, (pierPara.pierRebar.pilecap_penetration_depth + pierPara.pierRebar.beam_penetration_depth), valueS);
            rebarLst.Add(tu);

            Point2d PtN2 = insertPoint.C2D(45 * scale);
            if (pierPara.pierRebar.is_out_double && pierPara.pierRebar.tendon_length > 0)
            {
                Point2d PtN1c = insertPoint.C2D(32.5 * scale);
                RebarPLPloter.CreateBreakLine(db, ref ext, PtN1c.C2D(0, -100 * scale), PtN1c.C2D(0, -220 * scale), scale, "H钢筋");
                midC = GeTools.MidPoint(PtN1c.C3D(0, -120 * scale), PtN1c.C3D(0, -220 * scale));

                RebarDimPloter.RebarWireNew(db, ref ext, midC.C2D(0, 10 * scale), noS, "H/2", "1c",
         GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            }
            else
                PtN2 = insertPoint.C2D(40 * scale);
            #endregion

            #region N2

            RebarPLPloter.CreateBreakLine(db, ref ext, PtN2, PtN2.C2D(0, -220 * scale), scale, "H钢筋");

            noS = strMainDiameter + ((int)pierPara.pierRebar.main_reinforcement_diameter).ToString();
            valueS ="均("+ ("H+" + (pierPara.pierRebar.pilecap_penetration_depth + pierPara.pierRebar.beam_penetration_depth).ToString("0.0"))+")/2";
            midC = GeTools.MidPoint(PtN2.C3D(), PtN2.C3D(0, -220 * scale));
            //if (pierPara.pierRebar.main_reinforcement_grade == "HRB650E")
            //{
            //    RebarDimPloter.RebarWire650(db, ref ext, midC.C2D(0, 10 * scale), midC.C2D(2 * scale, 10 * scale + 5 * scale),noS, valueS, "2",strMainDiameter,
            //GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            //}
            //else
            //{
                RebarDimPloter.RebarWireNew(db, ref ext, midC.C2D(0, 10 * scale), noS, valueS, "2",
       GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            //}

            //noS = strMainDiameter + ((int)pierPara.pierRebar.inner_main_reinforcement_diameter).ToString();
            Point2d PtN2a = PtN2.C2D(25 * scale);
            RebarPLPloter.CreateBreakLine(db, ref ext, PtN2a, PtN2a.C2D(0, -220 * scale), scale, "H钢筋");

            noS = strMainDiameter + ((int)pierPara.pierRebar.inner_main_reinforcement_diameter).ToString();
            valueS = ("H+" + (pierPara.pierRebar.pilecap_penetration_depth + pierPara.pierRebar.beam_penetration_depth).ToString("0.0"));
            midC = GeTools.MidPoint(PtN2a.C3D(), PtN2a.C3D(0, -220 * scale));
            //if (pierPara.pierRebar.main_reinforcement_grade == "HRB650E")
            //{
            //    RebarDimPloter.RebarWire650(db, ref ext, midC.C2D(0, 10 * scale), midC.C2D(2 * scale, 10 * scale + 5 * scale), noS, valueS, "2a", strMainDiameter,
            //GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            //}
            //else
            //{
                RebarDimPloter.RebarWireNew(db, ref ext, midC.C2D(0, 10 * scale), noS, valueS, "2a",
       GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            //}
            TextPloter.AddDBText(db,midC.C3D(0, -10 * scale), ref ext, angS, scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90));

            Point2d PtN2b = PtN2a.C2D(20 * scale);
            RebarPLPloter.CreateBreakLine(db, ref ext, PtN2b, PtN2b.C2D(0, -220 * scale), scale, "H钢筋");

            noS = strMainDiameter + ((int)pierPara.pierRebar.inner_main_reinforcement_diameter).ToString();
            valueS = ("H+" + (pierPara.pierRebar.pilecap_penetration_depth + pierPara.pierRebar.beam_penetration_depth).ToString("0.0"));
            midC = GeTools.MidPoint(PtN2b.C3D(), PtN2b.C3D(0, -220 * scale));
            //if (pierPara.pierRebar.main_reinforcement_grade == "HRB650E")
            //{
            //    RebarDimPloter.RebarWire650(db, ref ext, midC.C2D(0, 10 * scale), midC.C2D(2 * scale, 10 * scale + 5 * scale), noS, valueS, "2b", strMainDiameter,
            //GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            //}
            //else
            //{
                RebarDimPloter.RebarWireNew(db, ref ext, midC.C2D(0, 10 * scale), noS, valueS, "2b",
       GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            //}
            //TextPloter.AddDBText(db,midC.C3D(0, -10 * scale), ref ext, angS, scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90));
            //int N2 = (pierPara.pierRebar.main_l_change_num - 1) * 2;
            //tu = new Tuple<string, eDB, int, double, string>("2", pierPara.pierRebar.main_reinforcement_diameter, N2, (pierPara.pierRebar.pilecap_penetration_depth + pierPara.pierRebar.beam_penetration_depth), valueS);
            //rebarLst.Add(tu);
            #endregion


            Point2d ptN30 = pt.C2D(0, -60 * scale);
            PLPloter.AddPloy4(db, ptN30, 20 * scale, 20 * scale, 25 * scale, ref ext, "H钢筋");
            PLPloter.AddBoldPolyline(db,ptN30.C2D(15 * scale, -25 * scale + 2), ptN30.C2D(12 * scale, -25 * scale + 2), ref ext, "H细线", 4);
            double diaNs = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_stirrup_reinforcement_diameter] * 0.1;
            double capR = 20;
            if (5 * diaNs > capR)
                capR = 25;
            noS = strDiameter + ((int)pierPara.pierRebar.pier_stirrup_reinforcement_diameter).ToString();
            double leW = pierPara.column.top_w - 2 * pierPara.pierRebar.pier_protect_layer - diaNs;
            double leL = pierPara.column.top_l - 2 * pierPara.pierRebar.pier_protect_layer - diaNs;
            //double leLB = pierPara.column.top_l - 2 * pierPara.pierRebar.pier_protect_layer - diaNs; ;
            TextPloter.AddDBText(db,ptN30.C3D(-17 * scale, -15 * scale), ref ext,"均"+ leL.ToString("0.0")+ "+H/" + (1 / (pierPara.column.slope_l)), scale, 2, "SRB.HT", GeTools.DegreeToRadian(90));
            TextPloter.AddDBText(db,ptN30.C3D(-2 * scale, -3 * scale), ref ext, leW.ToString("0.0"), scale, 2, "SRB.HT", 0);
            TextPloter.AddDBText(db,ptN30.C3D(12 * scale, -25 * scale + 4), ref ext, capR.ToString(), scale, 2, "SRB.HT", 0);
            double lenN30 = leW * 2 + leL * 2 -4 * GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_stirrup_reinforcement_diameter] + capR;
            valueS = "均" + (lenN30).ToString("0.0") + "+H/" + (1 / (pierPara.column.slope_l * 2));
            RebarDimPloter.RebarWireNew(db, ref ext, ptN30.C2D(0, 0), noS, valueS, "3",
            GeTools.DegreeToRadian(0), Extensions.curFont, scale);

            tu = new Tuple<string, eDB, int, double, string>("3", pierPara.pierRebar.pier_stirrup_reinforcement_diameter, 0, lenN30, valueS);
            rebarLst.Add(tu);



            Point2d ptN3 = ptN30.C2D(0 * scale, -35 * scale);
            noS = strDiameter + ((int)pierPara.pierRebar.pier_solid_reinforcement_diameter).ToString();
            double angle = 0;// Math.Atan(tH / tw);
           double len = pierPara.column.top_w - 2 * pierPara.pierRebar.pier_protect_layer;
            double diaN3 = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_solid_reinforcement_diameter] * 0.1;
  
            double lN3 = lenN3All ;
            valueS = lN3.ToString("0.0");
            RebarSample.AddLineSampleNew(ptN3, ref ext, "H钢筋", pierPara.pierRebar.pier_solid_reinforcement_diameter, angle, (lenN3All).ToString("0.0"),  35 * scale,  scale, 2, true);
            RebarDimPloter.RebarWireNew(db, ref ext, ptN3.C2D(0, 0), ptN3.C2D(2 * scale, -5 * scale), noS, valueS, "3a",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            int N3 = 0;

            tu = new Tuple<string, eDB, int, double, string>("3a", pierPara.pierRebar.pier_solid_reinforcement_diameter, N3, lN3, lN3.ToString("0.0"));
            rebarLst.Add(tu);

            Point2d ptN3a = ptN3.C2D(0 * scale, -20 * scale);
            int N45 = (int)(pierPara.pierRebar.bottom_encryption_length / pierPara.pierRebar.bottom_encryption_spacing) + (int)(pierPara.pierRebar.top_encryption_length / pierPara.pierRebar.top_encryption_spacing) + (int)((pierPara.pier_height * 100 - pierPara.pierRebar.top_encryption_length - pierPara.pierRebar.bottom_encryption_length) / pierPara.pierRebar.bottom_encryption_spacing);
            //double diaN8 = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_solid_reinforcement_diameter] * 0.1;
            double lN3a = lenN3a;
            noS = strDiameter + ((int)pierPara.pierRebar.pier_solid_reinforcement_diameter).ToString();
            valueS = lN3a.ToString("0.0");
            RebarSample.AddLineSampleNew(ptN3a, ref ext, "H钢筋", pierPara.pierRebar.pier_angle_reinforcement_diameter, angle, (lenN3a).ToString("0.0"), 28 * scale,  scale, 2, true);
            RebarDimPloter.RebarWireNew(db, ref ext, ptN3a.C2D(0, 0), ptN3a.C2D(2 * scale, -5 * scale), noS, valueS, "3b",
        GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            int N3a = N45 * (4);

            tu = new Tuple<string, eDB, int, double, string>("3b", pierPara.pierRebar.pier_angle_reinforcement_diameter, N3a, lN3a, lN3a.ToString("0.0"));
            rebarLst.Add(tu);


            #region N4,N5
            Point2d ptN4 = ptN3a.C2D(0, -25 * scale);
            PLPloter.AddPloy4(db, ptN4, 20*scale, 20 * scale, 5*scale,ref ext, "H钢筋");
            PLPloter.AddBoldPolyline(db, ptN4.C2D(10 * scale,-5*scale+2), ptN4.C2D(12 * scale, -5 * scale+2), ref ext, "H细线",4);
            diaNs = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_stirrup_reinforcement_diameter] * 0.1;
            capR = 20;
            if (5 * diaNs > capR)
                capR = 25;
            noS = strDiameter + ((int)pierPara.pierRebar.pier_stirrup_reinforcement_diameter).ToString();
            double lenW = pierPara.column.top_w - 2 * pierPara.pierRebar.pier_protect_layer - diaN45;
            double lenL = spancslLst.Sum()+diaN1*0.5+ diaN1Inner*0.5 + diaN45;

            TextPloter.AddDBText(db,ptN4.C3D(-17 * scale,-4.5*scale), ref ext, lenL.ToString("0.0"), scale, 2, "SRB.HT", GeTools.DegreeToRadian(90));
            TextPloter.AddDBText(db,ptN4.C3D(-10 * scale, -5 * scale), ref ext, lenW.ToString("0.0"), scale, 2, "SRB.HT", 0);
            TextPloter.AddDBText(db,ptN4.C3D(10 * scale, -5 * scale + 4), ref ext, capR.ToString(), scale, 2, "SRB.HT", 0);
            double lenN4 = lenW * 2 + lenL * 2 + capR - 4 * GlobalFuncs.CalculateReduction(pierPara.pierRebar.pier_stirrup_reinforcement_diameter, 90);
            valueS = (lenW*2+lenL*2+ capR - 4 * GlobalFuncs.CalculateReduction(pierPara.pierRebar.pier_stirrup_reinforcement_diameter,90)).ToString("0.0");        
            RebarDimPloter.RebarWireNew(db, ref ext, ptN4.C2D(0, 0), noS, valueS, "4",
            GeTools.DegreeToRadian(0), Extensions.curFont, scale);
           
            tu = new Tuple<string, eDB, int, double, string>("4", pierPara.pierRebar.pier_stirrup_reinforcement_diameter, N45, lenN4, valueS);
            rebarLst.Add(tu);



            Point2d ptN4a = ptN4.C2D(0 * scale, -25 * scale);
            PLPloter.AddPloy4(db, ptN4a, 5 * scale, 5 * scale, 5 * scale, ref ext, "H钢筋");
            PLPloter.AddBoldPolyline(db, ptN4a.C2D(1 * scale, -5 * scale + 2), ptN4a.C2D(3 * scale, -5 * scale + 2), ref ext, "H细线", 4);
            
            noS = strDiameter + ((int)pierPara.pierRebar.pier_stirrup_reinforcement_diameter).ToString();
            double lenN4aW = pierPara.pierRebar.main_w_space* pierPara.pierRebar.stirrup_count*2+ diaN1 + diaN45;

            TextPloter.AddDBText(db,ptN4a.C3D(-5 * scale, -4.5 * scale), ref ext, lenL.ToString("0.0"), scale, 2, "SRB.HT", GeTools.DegreeToRadian(90));
            TextPloter.AddDBText(db,ptN4a.C3D(-4 * scale, -5 * scale), ref ext, lenN4aW.ToString("0.0"), scale, 2, "SRB.HT", 0);
            TextPloter.AddDBText(db,ptN4a.C3D(1 * scale, -5 * scale + 4), ref ext, capR.ToString(), scale, 2, "SRB.HT", 0);
            double lenN4a = lenN4aW * 2 + lenL * 2 + capR - 4 * GlobalFuncs.CalculateReduction(pierPara.pierRebar.pier_stirrup_reinforcement_diameter, 90);
            valueS = (lenN4aW * 2 + lenL * 2 + capR - 4 * GlobalFuncs.CalculateReduction(pierPara.pierRebar.pier_stirrup_reinforcement_diameter, 90)).ToString("0.0");
            RebarDimPloter.RebarWireNew(db, ref ext, ptN4a.C2D(0, 0), noS, valueS, "4a",
            GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            int num = spancmLst.Count / pierPara.pierRebar.stirrup_count;
            if (spancmLst.Count % pierPara.pierRebar.stirrup_count >= pierPara.pierRebar.stirrup_count * 0.25)
            {
                num = num + 1;
            }
            int N45a = N45 * (num*2);

            tu = new Tuple<string, eDB, int, double, string>("4a", pierPara.pierRebar.pier_stirrup_reinforcement_diameter, N45a, lenN4a, valueS);
            rebarLst.Add(tu);





            double lenN5aW = spancsLst.Sum() + diaN1 * 0.5 + diaN1Inner*0.5 + diaN45;

            Point2d ptN5 = ptN4a.C2D(-10 * scale, -20 * scale);
            PLPloter.AddPloy4(db, ptN5, 2.5 * scale, 2.5 * scale, 40 * scale, ref ext, "H钢筋");
            PLPloter.AddBoldPolyline(db, ptN5.C2D(2.5 * scale - 2, -5 * scale), ptN5.C2D(2.5 * scale - 2, -7 * scale), ref ext, "H细线", 4);

            noS = strDiameter + ((int)pierPara.pierRebar.pier_stirrup_reinforcement_diameter).ToString();
            double ltlen= pierPara.column.top_l - 2 * pierPara.pierRebar.pier_protect_layer -  GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_stirrup_reinforcement_diameter];
            string Ls = ltlen + "～" + ltlen + "+H/" + (1 / (pierPara.column.slope_l * 2));
            string LsAvg = "均" + ltlen + "+H/" + (1 / (pierPara.column.slope_l));
            TextPloter.AddDBText(db,ptN5.C3D(-2.5 * scale, -30 * scale), ref ext, Ls.ToString(), scale, 2, "SRB.HT", GeTools.DegreeToRadian(90));
            TextPloter.AddDBText(db,ptN5.C3D(0.5 * scale, -30 * scale), ref ext, LsAvg.ToString(), scale, 2, "SRB.HT", GeTools.DegreeToRadian(90));
            TextPloter.AddDBText(db,ptN5.C3D(0, -38 * scale), ref ext, lenN5aW.ToString("0.0"), scale, 2, "SRB.HT", 0,TextHorizontalMode.TextMid,TextVerticalMode.TextVerticalMid);
            TextPloter.AddDBText(db,ptN5.C3D(2.5 * scale - 2, -7 * scale), ref ext, capR.ToString(), scale, 2, "SRB.HT", GeTools.DegreeToRadian(90));
            valueS = "均" + (ltlen*2 + capR + lenN5aW * 2 - 4 * GlobalFuncs.CalculateReduction(pierPara.pierRebar.pier_stirrup_reinforcement_diameter, 90)) + "+H/" + (1 / (pierPara.column.slope_l * 2));
            double lN5 = (ltlen * 2 + capR + lenN5aW * 2 - 4 * GlobalFuncs.CalculateReduction(pierPara.pierRebar.pier_stirrup_reinforcement_diameter, 90));
            RebarDimPloter.RebarWireNew(db, ref ext, ptN5.C2D(2.5 * scale, -25 * scale), noS, valueS, "5",
            GeTools.DegreeToRadian(0), Extensions.curFont, scale);

            tu = new Tuple<string, eDB, int, double, string>("5", pierPara.pierRebar.pier_stirrup_reinforcement_diameter, N45, lN5, "均" + lN5.ToString());
            rebarLst.Add(tu);

            Point2d ptN5a = ptN5.C2D(20 * scale, 0);
            PLPloter.AddPloy4(db, ptN5a, 3 * scale, 3 * scale, 15 * scale, ref ext, "H钢筋");
            PLPloter.AddBoldPolyline(db, ptN5a.C2D(1 * scale, -15 * scale + 2), ptN5a.C2D(2.5 * scale, -15 * scale + 2), ref ext, "H细线", 4);

            noS = strDiameter + ((int)pierPara.pierRebar.pier_stirrup_reinforcement_diameter).ToString();
      
            double lenSL = pierPara.pierRebar.main_l_space * pierPara.pierRebar.stirrup_count*2 + diaN1 * 0.5 + diaN1Inner*0.5 + diaN45;
            TextPloter.AddDBText(db,ptN5a.C3D(-3 * scale, -6 * scale), ref ext, lenSL.ToString("0.0"), scale, 2, "SRB.HT", GeTools.DegreeToRadian(90));
            TextPloter.AddDBText(db,ptN5a.C3D(-2 * scale, -3 * scale), ref ext, lenN5aW.ToString("0.0"), scale, 2, "SRB.HT", 0);
            TextPloter.AddDBText(db,ptN5a.C3D(0.5 * scale, -15 * scale + 1), ref ext, capR.ToString(), scale, 2, "SRB.HT", 0);
            double lenN5a = lenN5aW * 2 + lenSL * 2 + capR - 4 * GlobalFuncs.CalculateReduction(pierPara.pierRebar.pier_stirrup_reinforcement_diameter, 90);
            valueS = (lenN5aW * 2 + lenSL * 2 + capR - 4 * GlobalFuncs.CalculateReduction(pierPara.pierRebar.pier_stirrup_reinforcement_diameter, 90)).ToString("0.0");
            RebarDimPloter.RebarWireNew(db, ref ext, ptN5a.C2D(0, 0), noS, valueS, "5a",
            GeTools.DegreeToRadian(0), Extensions.curFont, scale);

            num = spancmLst.Count / pierPara.pierRebar.stirrup_count;

            int N5a = N45 * (num * 2);
            tu = new Tuple<string, eDB, int, double, string>("5a", pierPara.pierRebar.pier_stirrup_reinforcement_diameter, N5a, lenN5a, valueS);
            rebarLst.Add(tu);

            if (N5b > 0)
            {
                Point2d ptN5b = ptN5a.C2D(0, -30*scale);
                double lN5b = lenN5aW + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_stirrup_reinforcement_diameter] + GeneralRebar.outerDia135Hoke[pierPara.pierRebar.pier_stirrup_reinforcement_diameter];
                noS = strDiameter + ((int)pierPara.pierRebar.pier_stirrup_reinforcement_diameter).ToString();
                valueS = lN5b.ToString("0.0");

                int N5bN = (int)N45 * N5b;
                RebarSample.AddStandardLineSampleNew(ptN5b, ref ext, "H钢筋", pierPara.pierRebar.pier_angle_reinforcement_diameter, angle, lenN5aW.ToString("0.0"), 6 * scale, 2.5 * scale, scale, 2, true);
                RebarDimPloter.RebarWireNew(db, ref ext, ptN5b.C2D(0, 0), ptN5b.C2D(2 * scale, -5 * scale), noS, valueS, "5b",
             GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            }

            #endregion

            #region N6-11

            string[] sizeT = pierPara.column.section_w_ang.Split('*');
            string[] sizeM = pierPara.column.section_mid_w_ang.Split('*');
            string[] sizeBulk = pierPara.column.bulkhead_size_w.Split('*');
            string[] sizeBulkL = pierPara.column.bulkhead_size_l.Split('*');
            double tH = double.Parse(sizeT[1]);
            double tw = double.Parse(sizeT[0]);
            double mH = double.Parse(sizeM[1]);
            double mw = double.Parse(sizeM[0]);
            double bH = double.Parse(sizeBulk[1]);
            double bw = double.Parse(sizeBulk[0]);
            double bwL = double.Parse(sizeBulkL[0]);
            double topH = pierPara.column.top_solid_h;
            double botH = pierPara.column.bottom_solid_h;


            Point2d ptN6 = pt.C2D(70 * scale, 0);
            angle = 0;
            len = pierPara.column.top_l-2*pierPara.pierRebar.pier_protect_layer+ 2 * pierPara.pierRebar.pier_protect_layer - topThickness*2-tw*2+40*(int)(pierPara.pierRebar.pier_solid_reinforcement_diameter)*0.1*2;
            double lenN6 = len;
            double diaN67 = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_solid_reinforcement_diameter] * 0.1;
            double lN6 = len;// +GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_solid_reinforcement_diameter] + GeneralRebar.outerDia135Hoke[pierPara.pierRebar.pier_solid_reinforcement_diameter];
            //lN6 = double.Parse((len + diaN67 * 5 * 2 + pierPara.pier_height * 100 / (pierPara.column.slope_l)).ToString("0.0"));
            valueS ="均"+ len.ToString("0.0") + "+H/" + (1 / (pierPara.column.slope_l)); ;
            RebarSample.AddLineSampleNew(ptN6, ref ext, "H钢筋", pierPara.pierRebar.pier_solid_reinforcement_diameter, angle, valueS,  20 * scale,  scale, 2, true);

            RebarDimPloter.RebarWireNew(db, ref ext, ptN6.C2D(0, 0), ptN6.C2D(2*scale, -5*scale), noS, "均" + lN6.ToString("0.0") + "+H/" + (1 / (pierPara.column.slope_l)), "6",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            int N6 = N45 * (4);

            tu = new Tuple<string, eDB, int, double, string>("6", pierPara.pierRebar.pier_solid_reinforcement_diameter, N6, lN6, valueS);
            rebarLst.Add(tu);

            Point2d ptN6a = ptN6.C2D(0, -30 * scale);
            angle = 0;
            len = pierPara.column.top_w - 2 * pierPara.pierRebar.pier_protect_layer + 2 * pierPara.pierRebar.pier_protect_layer - topThickness * 2 - tw * 2 + 40 * (int)(pierPara.pierRebar.pier_solid_reinforcement_diameter) * 0.1 * 2;
            double lenN6a = len;
            double lN6a = len;// +GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_solid_reinforcement_diameter] + GeneralRebar.outerDia135Hoke[pierPara.pierRebar.pier_solid_reinforcement_diameter];
            valueS = lN6a.ToString("0.0");
            RebarSample.AddLineSampleNew(ptN6a, ref ext, "H钢筋", pierPara.pierRebar.pier_solid_reinforcement_diameter, angle, (len).ToString("0.0"),  20 * scale,  scale, 2, true);
            RebarDimPloter.RebarWireNew(db, ref ext, ptN6a.C2D(0, 0), ptN6a.C2D(2 * scale, -5 * scale), noS, valueS, "6a",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            int N6a = N45 * (4);

            tu = new Tuple<string, eDB, int, double, string>("6a", pierPara.pierRebar.pier_solid_reinforcement_diameter, N6a, lN6a, lN6a.ToString("0.0"));
            rebarLst.Add(tu);


            Point2d ptN7 = ptN6a.C2D(0, -30 * scale);
            angle = 0;
            len = topH -  pierPara.pierRebar.pier_protect_layer+pierPara.pierRebar.beam_penetration_depth- GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_solid_reinforcement_diameter] - GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_solid_reinforcement_diameter]*0.5;
            double lenN7 = len;
            double lN7 = len + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_solid_reinforcement_diameter] ;
            valueS = lN7.ToString("0.0");
            RebarSample.AddStandardOneSideLineSampleNew(ptN7, ref ext, "H钢筋", pierPara.pierRebar.pier_solid_reinforcement_diameter, angle, (len).ToString("0.0"), 20 * scale, 2.5 * scale, scale, 2, true);
            RebarDimPloter.RebarWireNew(db, ref ext, ptN7.C2D(0, 0), ptN7.C2D(2 * scale, -5 * scale), noS, valueS, "7",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            int N7 = (int)(spancwLst.Count - spancsLst.Count) * 2/3;

            tu = new Tuple<string, eDB, int, double, string>("6a", pierPara.pierRebar.pier_solid_reinforcement_diameter, N7, lN7, lN7.ToString("0.0"));
            rebarLst.Add(tu);


            Point2d ptN8 = ptN7.C2D(0 * scale, -30 * scale);
            double diaN8 = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_solid_reinforcement_diameter] * 0.1;
            len = pierPara.column.top_w - 2 * pierPara.pierRebar.pier_protect_layer- diaN8;
          
            double lN8 = len + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_solid_reinforcement_diameter] + GeneralRebar.outerDia135Hoke[pierPara.pierRebar.pier_solid_reinforcement_diameter];
            noS = strDiameter + ((int)pierPara.pierRebar.pier_solid_reinforcement_diameter).ToString();
            valueS = lN8.ToString("0.0"); ;

            RebarSample.AddStandardLineSampleNew(ptN8, ref ext, "H钢筋", pierPara.pierRebar.pier_angle_reinforcement_diameter, angle, valueS,  20 * scale, 2.5 * scale, scale, 2, true);
            RebarDimPloter.RebarWireNew(db, ref ext, ptN8.C2D(0, 0), ptN8.C2D(2 * scale, -5 * scale), noS, valueS, "8",
         GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            int N8 = N45 * (4);

            tu = new Tuple<string, eDB, int, double, string>("8", pierPara.pierRebar.pier_angle_reinforcement_diameter, N8, lN8, lN8.ToString("0.0"));
            rebarLst.Add(tu);


            Point2d ptN8a = ptN8.C2D(0 * scale, -30 * scale);
            len = pierPara.column.top_l - 2 * pierPara.pierRebar.pier_protect_layer- diaN8;
           
            double diaN8a = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_solid_reinforcement_diameter] * 0.1;
            //double lN8a = len + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_solid_reinforcement_diameter] + GeneralRebar.outerDia135Hoke[pierPara.pierRebar.pier_solid_reinforcement_diameter];
            //noS = strDiameter + ((int)pierPara.pierRebar.pier_solid_reinforcement_diameter).ToString();
            //valueS = lN8a.ToString("0.0");

            double lN8a = len + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_solid_reinforcement_diameter] + GeneralRebar.outerDia135Hoke[pierPara.pierRebar.pier_solid_reinforcement_diameter];
            noS = strDiameter + ((int)pierPara.pierRebar.pier_solid_reinforcement_diameter).ToString();
            valueS = "均" + lN8a.ToString("0.0") + "+H/" + (1 / (pierPara.column.slope_l)); ;
            //double lN8a = lN6;
            //noS = strDiameter + ((int)pierPara.pierRebar.pier_solid_reinforcement_diameter).ToString();
            //valueS = lN8a.ToString("0.0");
            RebarSample.AddStandardLineSampleNew(ptN8a, ref ext, "H钢筋", pierPara.pierRebar.pier_angle_reinforcement_diameter, angle, (len).ToString("0.0"), 20 * scale, 2.5 * scale, scale, 2, true);
            RebarDimPloter.RebarWireNew(db, ref ext, ptN8a.C2D(0, 0), ptN8a.C2D(2 * scale, -5 * scale), noS, "均" + lN8.ToString("0.0") + "+H/" + (1 / (pierPara.column.slope_l)), "8a",
      GeTools.DegreeToRadian(0), Extensions.curFont, scale);
           
            int N8a = N45 * (4);

            tu = new Tuple<string, eDB, int, double, string>("8", pierPara.pierRebar.pier_angle_reinforcement_diameter, N8a, lN8a, lN8a.ToString("0.0"));
            rebarLst.Add(tu);

            #region 错误
            Point2d ptN9 = ptN8a.C2D(0, -30 * scale);
           

                angle = 0;
            len = topThickness- pierPara.pierRebar.pier_protect_layer+(tw) / 2;

            double lN9 = double.Parse((len + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_solid_reinforcement_diameter] + GeneralRebar.outerDia135Hoke[pierPara.pierRebar.pier_solid_reinforcement_diameter]).ToString("0.0"));
            valueS = "均"+ lN9.ToString("0.0");
            RebarSample.AddStandardLineSampleNew(ptN9, ref ext, "H钢筋", pierPara.pierRebar.pier_solid_reinforcement_diameter, angle, "均"+(len).ToString("0.0"),  20 * scale, 2.5 * scale, scale, 2, true);
                RebarDimPloter.RebarWireNew(db, ref ext, ptN9.C2D(0, 0), ptN9.C2D(2 * scale, -5 * scale), noS, valueS, "9",
    GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            int N9 = (int)((topH / pierPara.pierRebar.top_encryption_spacing + botH / pierPara.pierRebar.bottom_encryption_spacing) * 4);

            tu = new Tuple<string, eDB, int, double, string>("9", pierPara.pierRebar.pier_solid_reinforcement_diameter, N9, lN9, lN9.ToString("0.0"));
                rebarLst.Add(tu);
            #endregion

            Point2d ptN10 = ptN9.C2D(0, -30 * scale);

            angle = 0;
            len = pierPara.column.top_w - 2 * pierPara.pierRebar.pier_protect_layer - (GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_angle_reinforcement_diameter] * 0.1);
            double diaN10 = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_angle_reinforcement_diameter] * 0.1;
            double lN10 = len + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_angle_reinforcement_diameter] + GeneralRebar.outerDia135Hoke[pierPara.pierRebar.pier_angle_reinforcement_diameter];
            valueS = lN10.ToString("0.0");
            RebarSample.AddStandardLineSampleNew(ptN10, ref ext, "H钢筋", pierPara.pierRebar.pier_solid_reinforcement_diameter, angle, (len).ToString("0.0"), 20 * scale, 2.5 * scale, scale, 2, true);
            RebarDimPloter.RebarWireNew(db, ref ext, ptN10.C2D(0, 0), ptN10.C2D(2 * scale, -5 * scale), noS, valueS, "10",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            int N10 = N45 * (4);

            tu = new Tuple<string, eDB, int, double, string>("10", pierPara.pierRebar.pier_solid_reinforcement_diameter, N10, lN10, lN10.ToString("0.0"));
            rebarLst.Add(tu);

            Point2d ptN10a = ptN10.C2D(0, -30 * scale);

            angle = 0;
            len = pierPara.column.top_l - 2 * pierPara.pierRebar.pier_protect_layer  -(GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_angle_reinforcement_diameter] * 0.1);
            double lN10a = len + +GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_angle_reinforcement_diameter] + GeneralRebar.outerDia135Hoke[pierPara.pierRebar.pier_angle_reinforcement_diameter];
            valueS = "均" + len.ToString("0.0") + "+H/" + (1 / (pierPara.column.slope_l));
            RebarSample.AddStandardLineSampleNew(ptN10a, ref ext, "H钢筋", pierPara.pierRebar.pier_solid_reinforcement_diameter, angle, valueS,  20 * scale, 2.5 * scale, scale, 2, true);
            RebarDimPloter.RebarWireNew(db, ref ext, ptN10a.C2D(0, 0), ptN10a.C2D(2 * scale, -5 * scale), noS, "均" + lN10a.ToString("0.0") + "+H/" + (1 / (pierPara.column.slope_l)), "10a",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);
  
            int N10a = N45 * (4);

            tu = new Tuple<string, eDB, int, double, string>("10a", pierPara.pierRebar.pier_solid_reinforcement_diameter, N10a, lN10a, lN10a.ToString("0.0"));
            rebarLst.Add(tu);
            Point2d ptN13 = ptN10a;
            if (BulkheadCount > 0)
            {
                int nblk = (int)(bH / pierPara.pierRebar.block_reinforcement_space);
                //Point2d ptN11 = ptN10a.C2D(0, -20 * scale);
                Point2d ptN11 = pt.C2D(120 * scale, 0);
                angle = 0;
                len =lenN11L;
                double diaN11 = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_block_reinforcement_diameter] * 0.1;
                double lN11 = len;
                valueS = lN11.ToString("0.0");
                RebarSample.AddStandardLineSample(ptN11, ref ext, "H钢筋", pierPara.pierRebar.pier_solid_reinforcement_diameter, angle, (len).ToString("0.0"), "0", 20 * scale, 0 * scale, scale, 2, true);
                RebarDimPloter.RebarWireNew(db, ref ext, ptN11.C2D(0, 0), ptN11.C2D(2 * scale, -5 * scale), noS, valueS, "11",
    GeTools.DegreeToRadian(0), Extensions.curFont, scale);
                int N11 = BulkheadCount* nblk * (4);

                tu = new Tuple<string, eDB, int, double, string>("11", pierPara.pierRebar.pier_solid_reinforcement_diameter, N11, lN11, lN11.ToString("0.0"));
                rebarLst.Add(tu);



                Point2d ptN12 = ptN11.C2D(0, -30 * scale);
                double sideN1213 = bH - pierPara.pierRebar.pier_block_protect_layer * 2 + GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_block_reinforcement_diameter] * 0.1;
                double diaNB = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_block_reinforcement_diameter] * 0.1;
                angle = 0;
                double ll0 = pierPara.column.top_w - 2 * pierPara.pierRebar.pier_protect_layer;
                len = (ll0 - bw - pierPara.pierRebar.pier_block_protect_layer * 2) * 0.5- GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_block_reinforcement_diameter] * 0.1*0.5;
                double lN12 = len * 2 + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_block_reinforcement_diameter] * 2 + sideN1213-2*GlobalFuncs.CalculateReduction(pierPara.pierRebar.pier_block_reinforcement_diameter, 90);
                valueS = lN12.ToString("0.0");
                //RebarSample.AddStandardLineSample(ptN12, ref ext, "H钢筋", pierPara.pierRebar.pier_solid_reinforcement_diameter, angle, (len).ToString("0.0"), "15", 15 * scale, 0 * scale, scale, 2, true);
                PLPloter.AddLine(db,ptN12.C2D(-10 * scale, 0), ptN12.C2D(10 * scale, 0), ref ext, "H钢筋");
                PLPloter.AddLine(db,ptN12.C2D(-10 * scale, 5 * scale), ptN12.C2D(10 * scale, 5 * scale), ref ext, "H钢筋");
                PLPloter.AddLine(db,ptN12.C2D(-10 * scale, 5 * scale), ptN12.C2D(-10 * scale, 0), ref ext, "H钢筋");

                PLPloter.AddLine(db,ptN12.C2D(10 * scale, 0 * scale), ptN12.C2D(10 * scale, 1.5 * scale), ref ext, "H钢筋");
                PLPloter.AddLine(db,ptN12.C2D(10 * scale, 5 * scale), ptN12.C2D(10 * scale, 3.5 * scale), ref ext, "H钢筋");

                TextPloter.AddDBText(db,ptN12.C3D(-0.5 * scale, 5 * scale), ref ext, len.ToString(), scale, 2, "SRB.HT", GeTools.DegreeToRadian(0));
                TextPloter.AddDBText(db,ptN12.C3D(-10 * scale, 0), ref ext, sideN1213.ToString("0.0"), scale, 2, "SRB.HT", GeTools.DegreeToRadian(90));

                RebarDimPloter.RebarWireNew(db, ref ext, ptN12.C2D(0, 0), ptN12.C2D(2 * scale, -5 * scale), noS, valueS, "12",
    GeTools.DegreeToRadian(0), Extensions.curFont, scale);
                int N12 = N45 * (4);

                tu = new Tuple<string, eDB, int, double, string>("12", pierPara.pierRebar.pier_solid_reinforcement_diameter, N12, lN12, lN12.ToString("0.0"));
                rebarLst.Add(tu);


                ptN13 = ptN12.C2D(0, -30 * scale);

                angle = 0;
                double ll1 = pierPara.column.top_l - 2 * pierPara.pierRebar.pier_protect_layer;
                len = (ll1 - bwL - pierPara.pierRebar.pier_block_protect_layer * 2) * 0.5 - GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_block_reinforcement_diameter] * 0.1 * 0.5;
                double lN13 = len * 2 + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_block_reinforcement_diameter] * 2 + sideN1213 - 2 * GlobalFuncs.CalculateReduction(pierPara.pierRebar.pier_block_reinforcement_diameter, 90);
                //valueS = lN13.ToString("0.0");
                valueS = "均" + lN13.ToString("0.0") + "+H/" + (1 / (pierPara.column.slope_l * 2)); ;
                //RebarSample.AddStandardLineSample(ptN13, ref ext, "H钢筋", pierPara.pierRebar.pier_solid_reinforcement_diameter, angle, (len).ToString("0.0"), "0", 15 * scale, 0 * scale, scale, 2, true);
                PLPloter.AddLine(db,ptN13.C2D(-10 * scale, 0), ptN13.C2D(10 * scale, 0), ref ext, "H钢筋");
                PLPloter.AddLine(db,ptN13.C2D(-10 * scale, 5 * scale), ptN13.C2D(10 * scale, 5 * scale), ref ext, "H钢筋");
                PLPloter.AddLine(db,ptN13.C2D(-10 * scale, 5 * scale), ptN13.C2D(-10 * scale, 0), ref ext, "H钢筋");

                PLPloter.AddLine(db,ptN13.C2D(10 * scale, 0 * scale), ptN13.C2D(10 * scale, 1.5 * scale), ref ext, "H钢筋");
                PLPloter.AddLine(db,ptN13.C2D(10 * scale, 5 * scale), ptN13.C2D(10 * scale, 3.5 * scale), ref ext, "H钢筋");

                string bLs = len + "～" + len + "+H/" + (1 / (pierPara.column.slope_l * 2));
                string bLsAvg = "均" + len + "+H/" + (1 / (pierPara.column.slope_l));
                TextPloter.AddDBText(db,ptN13.C3D(-9 * scale, 2.5 * scale), ref ext, bLs.ToString(), scale, 2, "SRB.HT", GeTools.DegreeToRadian(0));
                TextPloter.AddDBText(db,ptN13.C3D(-6.5 * scale, 5 * scale), ref ext, bLsAvg.ToString(), scale, 2, "SRB.HT", GeTools.DegreeToRadian(0));
                TextPloter.AddDBText(db,ptN13.C3D(-10 * scale, 0), ref ext, sideN1213.ToString("0.0"), scale, 2, "SRB.HT", GeTools.DegreeToRadian(90));
                RebarDimPloter.RebarWireNew(db, ref ext, ptN13.C2D(0, 0), ptN13.C2D(2 * scale, -5 * scale), noS, valueS, "13",
    GeTools.DegreeToRadian(0), Extensions.curFont, scale);
                int N13 = N45 * (4);

                tu = new Tuple<string, eDB, int, double, string>("13", pierPara.pierRebar.pier_solid_reinforcement_diameter, N13, lN13, lN13.ToString("0.0"));
                rebarLst.Add(tu);
                Point2d ptNote = ptN13.C2D(-10 * scale, -110 * scale);

              


                Point2d ptN14 = ptN13.C2D(0, -30 * scale);
                angle = 0;
                len = pierPara.column.top_w - 2 * pierPara.pierRebar.pier_protect_layer;
                double diaN14 = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_solid_reinforcement_diameter] * 0.1;
                double lN14 = lenN9All;// + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_solid_reinforcement_diameter] + GeneralRebar.outerDia135Hoke[pierPara.pierRebar.pier_solid_reinforcement_diameter];
                valueS = lN14.ToString("0.0");
                RebarSample.AddLineSampleNew(ptN14, ref ext, "H钢筋", pierPara.pierRebar.pier_solid_reinforcement_diameter, angle, (lenN9All).ToString("0.0"), 20 * scale,  scale, 2, true);
                RebarDimPloter.RebarWireNew(db, ref ext, ptN14.C2D(0, 0), ptN14.C2D(2 * scale, -5 * scale), noS, valueS, "14",
    GeTools.DegreeToRadian(0), Extensions.curFont, scale);
                int N14 = N45 * (4);

                tu = new Tuple<string, eDB, int, double, string>("14", pierPara.pierRebar.pier_solid_reinforcement_diameter, N14, lN14, lN14.ToString("0.0"));
                rebarLst.Add(tu);

                //PlotPierSampleNote(ref db, ref ext, ptNote, scale);
            }
            else
            {
                Point2d ptNote = ptN13.C2D(-10 * scale, -50 * scale);

                //PlotPierSampleNote(ref db, ref ext, ptNote, scale);
            }
            #endregion

         
        }

        public void PlotPierRebarTable(ref Database db, out Extents2d ext, Point2d insertPoint, int scale,List<PierPara> pierDisList)
        {
            string[] sizeT = pierPara.column.section_w_ang.Split('*');
            string[] sizeM = pierPara.column.section_mid_w_ang.Split('*');
            string[] sizeBulk = pierPara.column.bulkhead_size_w.Split('*');
            string[] sizeBulkL = pierPara.column.bulkhead_size_l.Split('*');
            double tH = double.Parse(sizeT[1]);
            double tw = double.Parse(sizeT[0]);
            double mH = double.Parse(sizeM[1]);
            double mw = double.Parse(sizeM[0]);
            double bH = double.Parse(sizeBulk[1]);
            double bw = double.Parse(sizeBulk[0]);
            double bwL = double.Parse(sizeBulkL[0]);
            double topH = pierPara.column.top_solid_h;
            double botH = pierPara.column.bottom_solid_h;

            ext = new Extents2d(insertPoint, insertPoint);
            Point2d pt = insertPoint.C2D(0,-4*scale);
            List<string> list = new List<string>();
            list.Add("墩号");
            //list.Add("H\\P(cm)");
            list.Add("编号");
            list.Add("直径\\P(mm)");
            list.Add("单根长\\P(cm)");
            list.Add("根数");
            list.Add("总长\\P(m)");
            list.Add("单位重\\P(kg/m)");
            list.Add("总重\\P(kg)");
            list.Add("合计(kg)");
            double height = 0;
            double width = 0;
            double ActualWidth = 0, ActualHeight = 0;
            double volumTotal = 0;
            List<Tuple<PierPara, List<Tuple<string, eDB, int, double, string, string>>>> tuLst = new List<Tuple<PierPara, List<Tuple<string, eDB, int, double, string, string>>>>();
            for (int i=0;i< pierDisList.Count;i++)
            {
                List<Tuple<string, eDB, int, double, string, string>> rebarLst=new List<Tuple<string, eDB, int, double, string, string>>();
                CalPierRebar(pierDisList[i], ref rebarLst);
                tuLst.Add(new Tuple<PierPara, List<Tuple< string, eDB, int, double,string, string>>>(pierDisList[i], rebarLst));
                //double volum = pierDisList[i].column.top_w * 0.01 * (pierDisList[i].column.top_l + pierDisList[i].column.top_l + pierDisList[i].pier_height * 100 * pierDisList[i].column.slope_l*2) * 0.5 * 0.01 * pierDisList[i].pier_height - (pierDisList[i].column.top_w-topThickness*2-tw*2) * 0.01 * ((pierDisList[i].column.top_l + pierDisList[i].column.top_l + pierDisList[i].pier_height * 100 * pierDisList[i].column.slope_l*2) * 0.5 - topThickness*2 - tw  * 2) * 0.01 * (pierDisList[i].pier_height- pierDisList[i].column.top_solid_h*0.01- pierDisList[i].column.bottom_solid_h*0.01- bH*0.01*BulkheadCount);
                double volumAll = pierDisList[i].column.top_w * 0.01 * (pierDisList[i].column.top_l + pierDisList[i].column.top_l + pierDisList[i].pier_height * 100 * pierDisList[i].column.slope_l * 2) * 0.5 * 0.01 * pierDisList[i].pier_height;
                //double volumNull = (pierDisList[i].column.top_w - topThickness * 2 ) * 0.01 * ((pierDisList[i].column.top_l + pierDisList[i].column.top_l + pierDisList[i].pier_height * 100 * pierDisList[i].column.slope_l * 2) * 0.5 - topThickness * 2) * 0.01 * (pierDisList[i].pier_height - pierDisList[i].column.top_solid_h * 0.01 - pierDisList[i].column.bottom_solid_h * 0.01 - bH * 0.01 * BulkheadCount);
                //double volumAng = (tw * 0.01 * 0.5 * tw * 0.01 * 0.5 * tH * 0.01) * 4;
                //double volumBlk = bw * 0.01 * bwL * 0.01 * bH * 0.01;
                //double volumAngMid = (mw * 0.01 * 0.5 * mw * 0.01 * 0.5 * mH * 0.01) * 4;

                //double volum = volumAll- volumNull+ volumAng- volumBlk* BulkheadCount+ volumAngMid* BulkheadCount;

                double Area = (pierDisList[i].column.top_w - topThickness * 2) * 0.01 * ((pierDisList[i].column.top_l + pierDisList[i].column.top_l + pierDisList[i].pier_height * 100 * pierDisList[i].column.slope_l * 2) * 0.5 - topThickness * 2) * 0.01;
                double H=  (pierDisList[i].pier_height - pierDisList[i].column.top_solid_h * 0.01 - pierDisList[i].column.bottom_solid_h * 0.01 - bH * 0.01 * BulkheadCount - tH * 0.01 * 2 - mH * 0.01 * 2 * BulkheadCount);
                double volumNullNew = Area * H;
                double volum = volumAll - volumNullNew;
                string con= pierDisList[i].pierRebar.concrete_no+ "混凝土(m³)";
                height = 0;
                width = 0;
                pt = pt.C2D(ext.W()+3*scale);
                PierModelTablePloter.DrawPierRebarTable(db, ref ext, pt.C3D(), pierDisList[i], rebarLst, list, rebarLst.Count + 1+1, list.Count, ref height, ref width, Extensions.curFont, scale, volum, con);
                ActualWidth = 0;
                ActualHeight = 0;
                MText txt = TextPloter.GetTextActualWidth(db, "墩身钢筋明细表", scale, out ActualWidth, out ActualHeight, 4);
                TextPloter.AddMText(db,pt.C3D((width - ActualWidth) / 2, ActualHeight + scale * 2), ref ext, "墩身钢筋明细表", scale, 4, ActualWidth + 2*scale, Extensions.curFont);
                volumTotal += volum;
            }

         
            List<string> list1 = new List<string>();
            list1.Add("名称及规格");
            list1.Add("名称及规格");
            list1.Add("单位");
            list1.Add("总重");
            list1.Add("合计");
            double height1 = 0;
            double width1 = 0;
         
            MText txt1 = TextPloter.GetTextActualWidth(db, "墩身材料数量表(共" + tuLst.Count + "个)", scale, out ActualWidth, out ActualHeight, 4);
            PierModelTablePloter.DrawPierMaterialsTable(db, ref ext, insertPoint.C3D(width-35*scale, -height - ActualHeight * 3), tuLst, list1, list1.Count, ref height1, ref width1, Extensions.curFont, scale, volumTotal);
            TextPloter.AddMText(db,insertPoint.C3D(width - 35 * scale + (width1 - ActualWidth) / 2, -height - ActualHeight * 3 + ActualHeight + scale * 2), ref ext, "墩身材料数量表(共" + tuLst.Count + "个)", scale, 4, ActualWidth + 2 * scale, Extensions.curFont);
            try
            {
                BatchInsertQuentity(tuLst, volumTotal);
            }
            catch (Exception ex)
            {

            }
        }

        public void CalPierRebar(PierPara pierPara,ref List<Tuple<string, eDB, int, double, string, string>> rebarLst)
        {
            double BottomW = pierPara.column.top_l + pierPara.pier_height * 100 * pierPara.column.slope_l * 2;
            int changeNum = 0;
            int midNum = 0;
            List<Point2d> ptGGTLst = new List<Point2d>();
            RebarArrangement.ArrangePointBySpace(Point2d.Origin.C2D(), spancslLst, spancmlLst, 0, BottomW - 2 * sideOut, out ptGGTLst, out changeNum, out midNum, pierPara.pierRebar.main_l_space);

            rebarLst = new List<Tuple<string, eDB, int, double, string, string>>();

            string[] sizeBulk = pierPara.column.bulkhead_size_w.Split('*');
            double bH = double.Parse(sizeBulk[1]);

            double diaN1Inner = (GeneralRebar.outerDiaNew[pierPara.pierRebar.inner_main_reinforcement_diameter] * 0.1);
            double diaN1 = (GeneralRebar.outerDiaNew[pierPara.pierRebar.main_reinforcement_diameter] * 0.1);
            double diaN45 = (GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_stirrup_reinforcement_diameter] * 0.1);
            double diaNs = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_stirrup_reinforcement_diameter] * 0.1;
            #region N1
            double capR = 20;
            if (5 * diaNs > capR)
                capR = 25;

            string noS = strDiameter + ((int)pierPara.pierRebar.main_reinforcement_diameter).ToString();
            double N1Len = pierPara.pier_height * 100 + pierPara.pierRebar.pilecap_penetration_depth + pierPara.pierRebar.beam_penetration_depth;
            string valueS = (pierPara.pier_height*100 + pierPara.pierRebar.pilecap_penetration_depth + pierPara.pierRebar.beam_penetration_depth).ToString("0.0");
            double N1LenA =Math.Round( (pierPara.pier_height * 100 + pierPara.pierRebar.pilecap_penetration_depth + pierPara.pierRebar.beam_penetration_depth)*(1+Math.Tan(pierPara.column.slope_l)),1);
            string valueSA = (N1LenA).ToString("0.0");
            int N1 =(spancwLst.Count+1) * 2 ;
            Tuple<string, eDB, int, double, string, string> tu = new Tuple<string, eDB, int, double, string, string>("1", pierPara.pierRebar.main_reinforcement_diameter, N1, N1Len, valueS,strMainDiameter);
            rebarLst.Add(tu);

       
         
            int N1a =( spancslLst.Count) * 2*2;
            tu = new Tuple<string, eDB, int, double, string, string>("1a", pierPara.pierRebar.main_reinforcement_diameter, N1a, N1LenA, valueSA, strMainDiameter);
            rebarLst.Add(tu);

            int N1b = (spancmlLst.Count-1) * 2*2;
            tu = new Tuple<string, eDB, int, double, string, string>("1b", pierPara.pierRebar.main_reinforcement_diameter, N1b, N1Len, valueS, strMainDiameter);
            rebarLst.Add(tu);
            if (pierPara.pierRebar.is_out_double && pierPara.pierRebar.tendon_length > 0)
            {
                int N1c = (spancwLst.Count + 1 - 2) * 2;
                tu = new Tuple<string, eDB, int, double, string, string>("1c", pierPara.pierRebar.main_reinforcement_diameter, N1c, pierPara.pierRebar.tendon_length*100, (pierPara.pierRebar.tendon_length * 100).ToString("0.0"), strMainDiameter);
                rebarLst.Add(tu);
            }
            #endregion

            #region N2


            noS = strDiameter + ((int)pierPara.pierRebar.main_reinforcement_diameter).ToString();
            valueS = "均" + ((pierPara.pier_height * 100 + pierPara.pierRebar.pilecap_penetration_depth + pierPara.pierRebar.beam_penetration_depth)*0.5).ToString("0.0") ;       
            int N2 = (changeNum) * 2*2;
            double lenN2 = double.Parse(((pierPara.pier_height * 100 + pierPara.pierRebar.pilecap_penetration_depth + pierPara.pierRebar.beam_penetration_depth) * 0.5).ToString("0.0"));
            tu = new Tuple<string, eDB, int, double, string, string>("2", pierPara.pierRebar.main_reinforcement_diameter, N2, lenN2, valueS, strMainDiameter);
            rebarLst.Add(tu);

            noS = strDiameter + ((int)pierPara.pierRebar.inner_main_reinforcement_diameter).ToString();
            int N2a = (spancmlLst.Count - 1) * 2  + 2*4;
            tu = new Tuple<string, eDB, int, double, string, string>("2a", pierPara.pierRebar.inner_main_reinforcement_diameter, N2a, N1LenA, valueSA, strMainDiameter);
            rebarLst.Add(tu);

            valueS = (pierPara.pier_height * 100 + pierPara.pierRebar.pilecap_penetration_depth + pierPara.pierRebar.beam_penetration_depth).ToString("0.0");
            int N2b = (spancmLst.Count - 1) * 2 ;
            tu = new Tuple<string, eDB, int, double, string, string>("2b", pierPara.pierRebar.inner_main_reinforcement_diameter, N2b, N1Len, valueS, strMainDiameter);
            rebarLst.Add(tu);

            #endregion
            double topH = pierPara.column.top_solid_h;
            double botH = pierPara.column.bottom_solid_h;
            int N45 = (int)((pierPara.pierRebar.bottom_encryption_length - botH) / pierPara.pierRebar.bottom_encryption_spacing) + (int)((pierPara.pierRebar.top_encryption_length - topH) / pierPara.pierRebar.top_encryption_spacing) + (int)((pierPara.pier_height * 100 - pierPara.pierRebar.top_encryption_length - pierPara.pierRebar.bottom_encryption_length - BulkheadCount * bH) / pierPara.pierRebar.middle_encryption_spacing);
            int N45S = (int)(topH / pierPara.pierRebar.top_encryption_spacing + botH / pierPara.pierRebar.bottom_encryption_spacing);
            if (isModify)
            {
                N45 = (int)((pierPara.pierRebar.bottom_encryption_length - botH) / (pierPara.pierRebar.bottom_encryption_spacing*3)) + (int)((pierPara.pierRebar.top_encryption_length - topH) /( pierPara.pierRebar.top_encryption_spacing*3)) + (int)((pierPara.pier_height * 100 - pierPara.pierRebar.top_encryption_length - pierPara.pierRebar.bottom_encryption_length - BulkheadCount * bH) / (pierPara.pierRebar.middle_encryption_spacing*3));
                N45S = (int)(topH / (pierPara.pierRebar.top_encryption_spacing*3) + botH / (pierPara.pierRebar.bottom_encryption_spacing*3));
            }

            noS = strDiameter + ((int)pierPara.pierRebar.pier_stirrup_reinforcement_diameter).ToString();
            double leW = pierPara.column.top_w - 2 * pierPara.pierRebar.pier_protect_layer - diaNs;
            double leL = pierPara.column.top_l - 2 * pierPara.pierRebar.pier_protect_layer - diaNs;
            double lenN30 = leW * 2 + leL * 2 - 4 * GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_stirrup_reinforcement_diameter] + capR+ pierPara.pier_height * 100* pierPara.column.slope_l * 2;
            valueS = "均" + (lenN30).ToString("0.0");
            int N30 = (int)(botH / pierPara.pierRebar.bottom_encryption_spacing) + (int)(topH / pierPara.pierRebar.top_encryption_spacing);
            tu = new Tuple<string, eDB, int, double, string, string>("3", pierPara.pierRebar.pier_solid_reinforcement_diameter, N30 , lenN30, valueS, strDiameter);
            rebarLst.Add(tu);

            noS = strDiameter + ((int)pierPara.pierRebar.pier_solid_reinforcement_diameter).ToString();
            double angle = 0;// Math.Atan(tH / tw);
            double diaN3 = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_solid_reinforcement_diameter] * 0.1;
            double len = pierPara.column.top_w - 2 * pierPara.pierRebar.pier_protect_layer;
         
            double lN3 = lenN3All;
            valueS = lN3.ToString("0.0");
        
            int N3 = (N2a+N2b) *2;

            tu = new Tuple<string, eDB, int, double, string, string>("3a", pierPara.pierRebar.pier_solid_reinforcement_diameter, N3, lN3, lN3.ToString("0.0"), strDiameter);
            rebarLst.Add(tu);


            double lN3a = lenN3a ;
            noS = strDiameter + ((int)pierPara.pierRebar.pier_solid_reinforcement_diameter).ToString();
            valueS = lN3a.ToString("0.0");
            int N3a = (N45 + N45S)*4;
            tu = new Tuple<string, eDB, int, double, string, string>("3b", pierPara.pierRebar.pier_solid_reinforcement_diameter, N3a, lN3a, lN3a.ToString("0.0"), strDiameter);
            rebarLst.Add(tu);



            #region N4,N5

            //double capR = 20;
            //if (5 * diaN45 > capR)
            //    capR = 25;
            noS = strDiameter + ((int)pierPara.pierRebar.pier_stirrup_reinforcement_diameter).ToString();

            double lenW = pierPara.column.top_w - 2 * pierPara.pierRebar.pier_protect_layer - diaN45;
            double lenL = spancslLst.Sum() + diaN1 * 0.5 + diaN1Inner * 0.5 + diaN45;
            double lenN4 = lenW * 2 + lenL * 2 + capR - 4 * GlobalFuncs.CalculateReduction(pierPara.pierRebar.pier_stirrup_reinforcement_diameter, 90);
            valueS = (lenW * 2 + lenL * 2 + capR - 4 * GlobalFuncs.CalculateReduction(pierPara.pierRebar.pier_stirrup_reinforcement_diameter, 90)).ToString("0.0");
        
         
            tu = new Tuple<string, eDB, int, double, string, string>("4", pierPara.pierRebar.pier_stirrup_reinforcement_diameter, (N45) * 2, lenN4, valueS, strDiameter);
            rebarLst.Add(tu);



         
            noS = strDiameter + ((int)pierPara.pierRebar.pier_stirrup_reinforcement_diameter).ToString();
            //double lenN4aW = pierPara.pierRebar.main_w_space * pierPara.pierRebar.stirrup_count + diaN1 + diaN45;

            //double lenN4a = double.Parse((lenN4aW * 2 + lenL * 2 + capR).ToString("0.0"));
            //valueS = (lenN4a).ToString("0.0");
            double lenN4aW = pierPara.pierRebar.main_w_space * pierPara.pierRebar.stirrup_count*2 + diaN1 + diaN45;
            double lenN4a = lenN4aW * 2 + lenL * 2 + capR - 4 * GlobalFuncs.CalculateReduction(pierPara.pierRebar.pier_stirrup_reinforcement_diameter, 90);
            valueS = (lenN4aW * 2 + lenL * 2 + capR - 4 * GlobalFuncs.CalculateReduction(pierPara.pierRebar.pier_stirrup_reinforcement_diameter, 90)).ToString("0.0");
            //int num = spancmLst.Count / pierPara.pierRebar.stirrup_count;
            //if (spancmLst.Count % pierPara.pierRebar.stirrup_count >= pierPara.pierRebar.stirrup_count * 0.25)
            //{
            //    num = num + 1;
            //}
            int N45a = N45 * (N4a * 2);
            tu = new Tuple<string, eDB, int, double, string, string>("4a", pierPara.pierRebar.pier_stirrup_reinforcement_diameter, N45a, lenN4a, valueS, strDiameter);
            rebarLst.Add(tu);





            double lenN5aW = spancsLst.Sum() + diaN1 + diaN45;
            double ltlen = pierPara.column.top_l  - 2 * pierPara.pierRebar.pier_protect_layer;
            noS = strDiameter + ((int)pierPara.pierRebar.pier_stirrup_reinforcement_diameter).ToString();
            string Ls = ltlen + "～" + ltlen + (pierPara.pier_height * 100 * (pierPara.column.slope_l * 2));
            string LsAvg = "均" + ltlen +  (pierPara.pier_height * 100 * (pierPara.column.slope_l));        
            valueS = "均" + ((ltlen * 2  + lenN5aW * 2 + capR) + (pierPara.pier_height * 100 * (pierPara.column.slope_l * 2))).ToString("0.0");
            double lN5 =double.Parse(((pierPara.column.top_l * 2 + lenN5aW * 2 + capR) + (pierPara.pier_height * 100 * (pierPara.column.slope_l * 2))).ToString("0.0"));
   
            tu = new Tuple<string, eDB, int, double, string, string>("5", pierPara.pierRebar.pier_stirrup_reinforcement_diameter, (N45 + N45S) * 2, lN5, valueS, strDiameter);
            rebarLst.Add(tu);

          
            noS = strDiameter + ((int)pierPara.pierRebar.pier_stirrup_reinforcement_diameter).ToString();

            double lenSL = pierPara.pierRebar.main_l_space * pierPara.pierRebar.stirrup_count*2 + diaN1 + diaN45;       
            double lenN5a =double.Parse(( lenN5aW * 2 + lenSL * 2 + capR).ToString("0.0"));
            valueS = (lenN5aW * 2 + lenSL * 2 + capR).ToString("0.0");

            //num = spancmlLst.Count / pierPara.pierRebar.stirrup_count;
            int N5aNum = N45 * (N5a * 2);
            tu = new Tuple<string, eDB, int, double, string, string>("5a", pierPara.pierRebar.pier_stirrup_reinforcement_diameter, N5aNum, lenN5a, valueS, strDiameter);
            rebarLst.Add(tu);

            if (N5b > 0)
            {
                double lN5b = lenN5aW + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_stirrup_reinforcement_diameter] + GeneralRebar.outerDia135Hoke[pierPara.pierRebar.pier_stirrup_reinforcement_diameter];
                noS = strDiameter + ((int)pierPara.pierRebar.pier_stirrup_reinforcement_diameter).ToString();
                valueS = lN5b.ToString("0.0");

                int N5bN = (int)N45 * N5b;

                tu = new Tuple<string, eDB, int, double, string, string>("5b", pierPara.pierRebar.pier_stirrup_reinforcement_diameter, N5bN, lN5b, lN5b.ToString("0.0"), strDiameter);
                rebarLst.Add(tu);
            }
            //double lenN5b = lenN5aW + GeneralRebar.outerDia180Hoke[pierPara.pierRebar.pier_stirrup_reinforcement_diameter] * 2;
            //valueS = (lenN5aW  + GeneralRebar.outerDia180Hoke[pierPara.pierRebar.pier_stirrup_reinforcement_diameter] * 2).ToString("0.0");
            //lenN5b = double.Parse(valueS);
            //num = ((pierPara.pierRebar.main_l_change_num - 1) / 2) * 2;
            //int N5b = N45 * (num * 2);
            //tu = new Tuple<string, eDB, int, double, string, string>("5b", pierPara.pierRebar.pier_stirrup_reinforcement_diameter, N5b*2, lenN5b, valueS, strDiameter);
            //rebarLst.Add(tu);

            #endregion

            #region N6-11

            string[] sizeT = pierPara.column.section_w_ang.Split('*');
            string[] sizeM = pierPara.column.section_mid_w_ang.Split('*');
          
            string[] sizeBulkL = pierPara.column.bulkhead_size_l.Split('*');
            double tH = double.Parse(sizeT[1]);
            double tw = double.Parse(sizeT[0]);
            double mH = double.Parse(sizeM[1]);
            double mw = double.Parse(sizeM[0]);

            double bw = double.Parse(sizeBulk[0]);
            double bwL = double.Parse(sizeBulkL[0]);
        

            angle = 0;
            //len = pierPara.column.top_l - 2 * pierPara.pierRebar.pier_protect_layer;
            len = pierPara.column.top_l - 2 * pierPara.pierRebar.pier_protect_layer + 2 * pierPara.pierRebar.pier_protect_layer - topThickness * 2 - tw * 2 + 40 * (int)(pierPara.pierRebar.pier_solid_reinforcement_diameter) * 0.1 * 2;
            double lenN6 = len;
            double diaN67 = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_solid_reinforcement_diameter] * 0.1;
            //double lN6 = double.Parse((len +GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_solid_reinforcement_diameter] + GeneralRebar.outerDia135Hoke[pierPara.pierRebar.pier_solid_reinforcement_diameter] + pierPara.pier_height * 100 * (pierPara.column.slope_l)).ToString("0.0"));
            double lN6 = double.Parse((len).ToString("0.0"));
            valueS = "均"  + (lN6).ToString("0.0");
            
            int NLayer = (int)(pierPara.column.top_solid_h/pierPara.pierRebar.top_encryption_spacing) + (int)(pierPara.column.bottom_solid_h / pierPara.pierRebar.bottom_encryption_spacing);
            double ww = pierPara.column.top_w - 2 * pierPara.pierRebar.pier_protect_layer + 2 * pierPara.pierRebar.pier_protect_layer - topThickness * 2 - tw * 2;
            int N6 = 2 * ((int)(ww / pierPara.pierRebar.pier_solid_reinforcement_space))+BulkheadCount*((int)((ww - bw) /pierPara.pierRebar.pier_solid_reinforcement_space))*2;
            tu = new Tuple<string, eDB, int, double, string, string>("6", pierPara.pierRebar.pier_solid_reinforcement_diameter, N6, lN6, valueS, strDiameter);
            rebarLst.Add(tu);

           
            angle = 0;
            len = pierPara.column.top_w - 2 * pierPara.pierRebar.pier_protect_layer + 2 * pierPara.pierRebar.pier_protect_layer - topThickness * 2 - tw * 2 + 40 * (int)(pierPara.pierRebar.pier_solid_reinforcement_diameter) * 0.1 * 2;
            double lenN6a = len;
            //double lN6a =double.Parse(( len  +GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_solid_reinforcement_diameter] + GeneralRebar.outerDia135Hoke[pierPara.pierRebar.pier_solid_reinforcement_diameter]).ToString("0.0"));
            double lN6a = double.Parse((len).ToString("0.0"));
            valueS = lN6a.ToString("0.0");
            double ll = pierPara.column.top_l - 2 * pierPara.pierRebar.pier_protect_layer + 2 * pierPara.pierRebar.pier_protect_layer - topThickness * 2 - tw * 2 + pierPara.pier_height * 100 * pierPara.column.slope_l;
            int N6a = 2 * ((int)(ll / pierPara.pierRebar.pier_solid_reinforcement_space)) + BulkheadCount * ((int)((ll - bwL) / pierPara.pierRebar.pier_solid_reinforcement_space))*2;

            tu = new Tuple<string, eDB, int, double, string, string>("6a", pierPara.pierRebar.pier_solid_reinforcement_diameter, N6a, lN6a, lN6a.ToString("0.0"), strDiameter);
            rebarLst.Add(tu);

            len = topH - pierPara.pierRebar.pier_protect_layer + pierPara.pierRebar.beam_penetration_depth;
            //double lenN7 = len;
            //double lN7 = len + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_solid_reinforcement_diameter] + GeneralRebar.outerDia135Hoke[pierPara.pierRebar.pier_solid_reinforcement_diameter];
            //valueS = lN7.ToString("0.0");
            len = topH - pierPara.pierRebar.pier_protect_layer + pierPara.pierRebar.beam_penetration_depth - GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_solid_reinforcement_diameter] - GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_solid_reinforcement_diameter] * 0.5;
            double lenN7 = len;
            double lN7 = len + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_solid_reinforcement_diameter];
            valueS = lN7.ToString("0.0");
            int N7w = (int)((spancmLst.Count) / 3) + 1;
            int N7l= (int)((spancmLst.Count) / 3) + 1;
            int N7 = N7w * N7l*2;
            tu = new Tuple<string, eDB, int, double, string, string>("7", pierPara.pierRebar.pier_solid_reinforcement_diameter, N7, lN7, lN7.ToString("0.0"), strDiameter);
            rebarLst.Add(tu);

            double diaN8 = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_solid_reinforcement_diameter] * 0.1;
         
            len = pierPara.column.top_w - 2 * pierPara.pierRebar.pier_protect_layer - diaN8;

            double lN8 = len + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_solid_reinforcement_diameter] + GeneralRebar.outerDia135Hoke[pierPara.pierRebar.pier_solid_reinforcement_diameter];
            noS = strDiameter + ((int)pierPara.pierRebar.pier_solid_reinforcement_diameter).ToString();
            valueS = lN8.ToString("0.0");
          
            int N8 = (int)(NLayer*0.5)*N8N + (int)(NLayer * 0.5) * N8BN;

            tu = new Tuple<string, eDB, int, double, string, string>("8", pierPara.pierRebar.pier_angle_reinforcement_diameter, N8, lN8, lN8.ToString("0.0"), strDiameter);
            rebarLst.Add(tu);

          

            double diaN8a = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_solid_reinforcement_diameter] * 0.1;
            len = pierPara.column.top_l - 2 * pierPara.pierRebar.pier_protect_layer - diaN8a;
            double lN8a = len + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_solid_reinforcement_diameter] + GeneralRebar.outerDia135Hoke[pierPara.pierRebar.pier_solid_reinforcement_diameter];

            noS = strDiameter + ((int)pierPara.pierRebar.pier_solid_reinforcement_diameter).ToString();
            valueS = lN8a.ToString("0.0");

            int N8a = (int)(NLayer * 0.5) * N8aN + (int)(NLayer * 0.5) * N8aBN;
            tu = new Tuple<string, eDB, int, double, string, string>("8a", pierPara.pierRebar.pier_angle_reinforcement_diameter, N8a, lN8a, "均"+lN8a.ToString("0.0"), strDiameter);
            rebarLst.Add(tu);


            angle = 0;
            len = topThickness - pierPara.pierRebar.pier_protect_layer + (tw) / 2;

            double lN9 = double.Parse((len + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_solid_reinforcement_diameter] + GeneralRebar.outerDia135Hoke[pierPara.pierRebar.pier_solid_reinforcement_diameter]).ToString("0.0"));
            valueS = "均" + lN9.ToString("0.0");
                int N9 = (int)((topH/pierPara.pierRebar.top_encryption_spacing+ botH / pierPara.pierRebar.bottom_encryption_spacing)*4) ;

                tu = new Tuple<string, eDB, int, double, string, string>("9", pierPara.pierRebar.pier_solid_reinforcement_diameter, N9, lN9,"均"+ lN9.ToString("0.0"), strDiameter);
                rebarLst.Add(tu);
           
           
            angle = 0;
            len = pierPara.column.top_w - 2 * pierPara.pierRebar.pier_protect_layer - (GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_angle_reinforcement_diameter] * 0.1);
            double diaN10 = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_angle_reinforcement_diameter] * 0.1;
            double lN10 = double.Parse((len  +GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_angle_reinforcement_diameter] + GeneralRebar.outerDia135Hoke[pierPara.pierRebar.pier_angle_reinforcement_diameter]).ToString("0.0"));
            valueS = lN10.ToString("0.0");
         
            int N10 =(int) ((lenN3All-lenN3-lenN3T)/pierPara.pierRebar.pier_angle_reinforcement_space) * (4);

            tu = new Tuple<string, eDB, int, double, string, string>("10", pierPara.pierRebar.pier_solid_reinforcement_diameter, N10, lN10, lN10.ToString("0.0"), strDiameter);
            rebarLst.Add(tu);

         

            angle = 0;
            len = pierPara.column.top_l - 2 * pierPara.pierRebar.pier_protect_layer - (GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_angle_reinforcement_diameter] * 0.1);
            double lN10a = double.Parse((pierPara.pier_height * 100* (pierPara.column.slope_l) + len + diaN10 * 5 * 2).ToString("0.0"));
            valueS = "均" +  (lN10a).ToString("0.0");

            int N10a = (int)((lenN3All - lenN3 - lenN3T) / pierPara.pierRebar.pier_angle_reinforcement_space) * (4);

            tu = new Tuple<string, eDB, int, double, string, string>("10a", pierPara.pierRebar.pier_solid_reinforcement_diameter, N10a, lN10a, "均" + lN10a.ToString("0.0"), strDiameter);
            rebarLst.Add(tu);


            angle = 0;
       
            double diaN11 = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_block_reinforcement_diameter] * 0.1;
            double lN11 = double.Parse((lenN11L).ToString("0.0"));
            valueS = lN11.ToString("0.0");
            if (BulkheadCount > 0)
            {
                int N11 = BulkheadCount * ((int)((bH - 2 * pierPara.pierRebar.pier_block_protect_layer) / pierPara.pierRebar.pier_solid_reinforcement_space) + 1) * (4);

                tu = new Tuple<string, eDB, int, double, string, string>("11", pierPara.pierRebar.pier_solid_reinforcement_diameter, N11, lN11, lN11.ToString("0.0"), strDiameter);
                rebarLst.Add(tu);



                double sideN1213 = bH - pierPara.pierRebar.pier_block_protect_layer * 2 + GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_block_reinforcement_diameter] * 0.1;
                double diaNB = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_block_reinforcement_diameter] * 0.1;
                angle = 0;
                double ll0 = pierPara.column.top_w - 2 * pierPara.pierRebar.pier_protect_layer;
                len = (ll0 - bw - pierPara.pierRebar.pier_block_protect_layer * 2) * 0.5 - GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_block_reinforcement_diameter] * 0.1 * 0.5;
                double lN12 = len * 2 + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_block_reinforcement_diameter] * 2 + sideN1213 - 2 * GlobalFuncs.CalculateReduction(pierPara.pierRebar.pier_block_reinforcement_diameter, 90);
                valueS = lN12.ToString("0.0");
                //double sideN1213 = bH - pierPara.pierRebar.pier_block_protect_layer * 2 + GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_block_reinforcement_diameter] * 0.1;
                //double diaNB = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_block_reinforcement_diameter] * 0.1;
                //angle = 0;
                //double ll0 = pierPara.column.top_w - 2 * pierPara.pierRebar.pier_protect_layer;
                //len = (ll0 - bw - pierPara.pierRebar.pier_block_protect_layer * 2) * 0.5;
                //double lN12 = double.Parse((len * 2 + sideN1213 + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_block_reinforcement_diameter] * 2).ToString("0.0"));
                //valueS = lN12.ToString("0.0");

                int N12 = BulkheadCount * ((int)((bH - 2 * pierPara.pierRebar.pier_block_protect_layer) / pierPara.pierRebar.pier_solid_reinforcement_space) + 1) * (int)(bwL/pierPara.pierRebar.block_mid_space);
                tu = new Tuple<string, eDB, int, double, string, string>("12", pierPara.pierRebar.pier_solid_reinforcement_diameter, N12, lN12, lN12.ToString("0.0"), strDiameter);
                rebarLst.Add(tu);



                angle = 0;
                double ll1 = pierPara.column.top_l - 2 * pierPara.pierRebar.pier_protect_layer;
                len = (ll1 - bwL - pierPara.pierRebar.pier_block_protect_layer * 2) * 0.5 - GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_block_reinforcement_diameter] * 0.1 * 0.5;
                double lN13 = double.Parse((len * 2 + GeneralRebar.outerDiaHoke[pierPara.pierRebar.pier_block_reinforcement_diameter] * 2 + sideN1213 + (pierPara.pier_height * 100 * (pierPara.column.slope_l * 2))).ToString("0.0"));

                string bLs = len + "～" + len + (pierPara.pier_height * 100 / (pierPara.column.slope_l * 2));
                string bLsAvg = "均" + len + (pierPara.pier_height * 100 / (pierPara.column.slope_l));
                int N13 = BulkheadCount * ((int)((bH - 2 * pierPara.pierRebar.pier_block_protect_layer) / pierPara.pierRebar.pier_solid_reinforcement_space) + 1) *(int)(bw / pierPara.pierRebar.block_mid_space); ;

                tu = new Tuple<string, eDB, int, double, string, string>("13", pierPara.pierRebar.pier_solid_reinforcement_diameter, N13, lN13, "均" + lN13.ToString("0.0"), strDiameter);
                rebarLst.Add(tu);


                angle = 0;
                len = pierPara.column.top_w - 2 * pierPara.pierRebar.pier_protect_layer;
                //double diaN9 = GeneralRebar.outerDiaNew[pierPara.pierRebar.pier_solid_reinforcement_diameter] * 0.1;
                double lN14 = double.Parse((lenN9All ).ToString("0.0"));
                valueS = lN14.ToString("0.0");
                int N14 = BulkheadCount * ((int)((bH - 2 * pierPara.pierRebar.pier_block_protect_layer) / pierPara.pierRebar.pier_solid_reinforcement_space) + 1) * (4);

                tu = new Tuple<string, eDB, int, double, string, string>("14", pierPara.pierRebar.pier_solid_reinforcement_diameter, N14, lN14, lN14.ToString("0.0"), strDiameter);
                rebarLst.Add(tu);
            }
            #endregion


        }
        #endregion

        #region 参数表
        public  void DrawParaTable(Database db, ref Extents2d ext, Point3d startPoint,  List<PierPara> pierDisList,
    ref double tbHeight, ref double tbWidth, string txtStyle, double scale)
        {
            if (pierDisList[0].pier_height <= 30)
                BulkheadCount = 0;
            else if (pierDisList[0].pier_height > 30 && pierDisList[0].pier_height <= 60)
                BulkheadCount = 1;
            else if (pierDisList[0].pier_height >= 60)
                BulkheadCount = 2;
            string[] sizeBulk = pierPara.column.bulkhead_size_w.Split('*');

            double bH = double.Parse(sizeBulk[1]);
            List<string> headName = new List<string>();
            headName.Add("墩号");
            headName.Add("H(cm)");
            headName.Add("Bd1(cm)");
            headName.Add("C(cm)");
            headName.Add("n");
            headName.Add("n1");
            if (BulkheadCount>0)
              headName.Add("m");
           
            double width = 0;
            int colNum = headName.Count;
            int rowNum= pierDisList.Count + 1;
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                BlockTable blockTbl = tr.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable;
                BlockTableRecord modelSpace = tr.GetObject(blockTbl[BlockTableRecord.ModelSpace],
                    OpenMode.ForWrite) as BlockTableRecord;
                LayerTable lt = tr.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable;
                ObjectId id;
                TextStyleTable st = tr.GetObject(db.TextStyleTableId, OpenMode.ForRead) as TextStyleTable;
                id = st[txtStyle];
               
                // 创建table 
                Table tb = new Table();
                tb.SetSize(rowNum, colNum);       // 设置几行几列
                tb.Position = startPoint;
                tb.GenerateLayout();

                // 设置表头
                for (int i = 0; i < colNum; ++i)
                {
                    tb.Cells[0, i].TextString = headName[i]; //获取i行j列数据
                    tb.Cells[0, i].Contents[0].TextHeight = 3 * scale;
                    tb.Cells[0, i].Alignment = CellAlignment.MiddleCenter;
                    tb.Cells[0, i].Contents[0].Rotation = 0;
                    tb.Cells[0, i].Borders.Horizontal.Margin = 2 * scale;
                    tb.Cells[0, i].Contents[0].TextStyleId = id;
                }
                tb.Rows[0].Height = 8 * scale;
               

                #region 表格添加数据
                int index = 0;
                for (int i = 0; i < pierDisList.Count; ++i)
                {
                    int changeNum = 0;
                    int midNum = 0;
                    List<Point2d> ptGGTLst = new List<Point2d>();
                    double BottomW = pierDisList[i].column.top_l + pierDisList[i].pier_height * 100 * pierDisList[i].column.slope_l * 2;
                    RebarArrangement.ArrangePointBySpace(startPoint.C2D(), spancslLst, spancmlLst, 0, BottomW - 2 * sideOut, out ptGGTLst, out changeNum, out midNum, pierPara.pierRebar.main_l_space);
                    double h = pierDisList[i].pier_height - pierDisList[i].column.top_solid_h * 0.01 - pierDisList[i].column.bottom_solid_h * 0.01 - bH * 0.01 * BulkheadCount;
                    tb.Cells[i+1,0].TextString = pierDisList[i].name +"墩"+ pierDisList[i].Location; //获取i行j列数据
                    tb.Cells[i+1,0].Contents[0].TextHeight = 3 * scale;
                    tb.Cells[i+1,0].Alignment = CellAlignment.MiddleCenter;
                    tb.Cells[i+1,0].Contents[0].Rotation = 0;
                    tb.Cells[i+1,0].Borders.Horizontal.Margin = 2 * scale;
                    tb.Cells[i+1,0].Contents[0].TextStyleId = id;

                    tb.Cells[i + 1, 1].TextString = ((pierDisList[i].pier_height)*100).ToString("0.0"); //获取i行j列数据
                    tb.Cells[i + 1, 1].Contents[0].TextHeight = 3 * scale;
                    tb.Cells[i + 1, 1].Alignment = CellAlignment.MiddleCenter;
                    tb.Cells[i + 1, 1].Contents[0].Rotation = 0;
                    tb.Cells[i + 1, 1].Borders.Horizontal.Margin = 2 * scale;
                    tb.Cells[i + 1, 1].Contents[0].TextStyleId = id;


                    tb.Cells[i + 1, 2].TextString = (BottomW).ToString("0.0"); //获取i行j列数据
                    tb.Cells[i + 1, 2].Contents[0].TextHeight = 3 * scale;
                    tb.Cells[i + 1, 2].Alignment = CellAlignment.MiddleCenter;
                    tb.Cells[i + 1, 2].Contents[0].Rotation = 0;
                    tb.Cells[i + 1, 2].Borders.Horizontal.Margin = 2 * scale;
                    tb.Cells[i + 1, 2].Contents[0].TextStyleId = id;

                    tb.Cells[i + 1, 3].TextString = ((pierDisList[i].column.top_l + pierDisList[i].pier_height * 100 * pierDisList[i].column.slope_l * 2- pierDisList[i].column.top_l) / (pierDisList[i].pierRebar.main_l_change_num*2)).ToString("0.0"); //获取i行j列数据
                    tb.Cells[i + 1, 3].Contents[0].TextHeight = 3 * scale;
                    tb.Cells[i + 1, 3].Alignment = CellAlignment.MiddleCenter;
                    tb.Cells[i + 1, 3].Contents[0].Rotation = 0;
                    tb.Cells[i + 1, 3].Borders.Horizontal.Margin = 2 * scale;
                    tb.Cells[i + 1, 3].Contents[0].TextStyleId = id;


                    tb.Cells[i + 1, 4].TextString = midNum.ToString(""); //获取i行j列数据
                    tb.Cells[i + 1, 4].Contents[0].TextHeight = 3 * scale;
                    tb.Cells[i + 1, 4].Alignment = CellAlignment.MiddleCenter;
                    tb.Cells[i + 1, 4].Contents[0].Rotation = 0;
                    tb.Cells[i + 1, 4].Borders.Horizontal.Margin = 2 * scale;
                    tb.Cells[i + 1, 4].Contents[0].TextStyleId = id;

                    int n1 = (int)((pierDisList[i].pier_height * 100 - pierDisList[i].pierRebar.bottom_encryption_spacing - pierDisList[i].pierRebar.pier_v_reinforcement_pilecap_depth) / pierDisList[i].pierRebar.top_encryption_spacing);
                    tb.Cells[i + 1, 5].TextString = n1.ToString(""); //获取i行j列数据
                    tb.Cells[i + 1, 5].Contents[0].TextHeight = 3 * scale;
                    tb.Cells[i + 1, 5].Alignment = CellAlignment.MiddleCenter;
                    tb.Cells[i + 1, 5].Contents[0].Rotation = 0;
                    tb.Cells[i + 1, 5].Borders.Horizontal.Margin = 2 * scale;
                    tb.Cells[i + 1, 5].Contents[0].TextStyleId = id;
                    if (BulkheadCount > 0)
                    {
                        tb.Cells[i + 1, 6].TextString = ((((pierDisList[i].pier_height * 100 * pierDisList[i].column.slope_l) * 2 + pierDisList[i].column.top_l -(h*100/BulkheadCount+ pierDisList[i].column.bottom_solid_h) * pierDisList[i].column.slope_l*2) - 2 * topThickness) / pierDisList[i].pierRebar.middle_encryption_spacing).ToString("0"); //获取i行j列数据
                        tb.Cells[i + 1, 6].Contents[0].TextHeight = 3 * scale;
                        tb.Cells[i + 1, 6].Alignment = CellAlignment.MiddleCenter;
                        tb.Cells[i + 1, 6].Contents[0].Rotation = 0;
                        tb.Cells[i + 1, 6].Borders.Horizontal.Margin = 2 * scale;
                        tb.Cells[i + 1, 6].Contents[0].TextStyleId = id;
                    }
                }
                #endregion

                // 设置列宽,行高
                for (int i = 0; i < colNum; ++i)
                {
                    if(i==0)
                        tb.Columns[i].Width = 25 * scale;
                    else
                        tb.Columns[i].Width = 15 * scale;

                }

                for (int i = 1; i < rowNum; ++i)
                {
                    tb.Rows[i].Height = 6 * scale;
                }

                tb.LayerId = lt["H细线"];
                modelSpace.AppendEntity(tb);
                tr.AddNewlyCreatedDBObject(tb, true);
                ext = ext.Add(new Extents2d(tb.Bounds.Value.MinPoint.C2D(), tb.Bounds.Value.MaxPoint.C2D()));

                List<Point2d> pList = new List<Point2d>();
                Point2d pt1 = startPoint.C2D();
                pList.Add(pt1);
                Point2d pt2 = pt1.C2D(0, -tb.Height);
                pList.Add(pt2);
                Point2d pt3 = pt1.C2D(tb.Width, -tb.Height);
                pList.Add(pt3);
                Point2d pt4 = pt1.C2D(tb.Width, 0);
                pList.Add(pt4);
                PLPloter.AddPolylineByPointList(db, pList, ref ext, "H粗线", true);
                tbHeight = tb.Height;
                tbWidth = tb.Width;
                tr.Commit();


            }
        }

        #endregion



        private void BatchInsertQuentity(List<Tuple<PierPara, List<Tuple<string, eDB, int, double, string, string>>>> tuLst,double volumTotal)
        {
            List<string> sqlList = new List<string>();
            if (tuLst.Count > 0)
            {
                eDB mainDia = pierPara.pierRebar.main_reinforcement_diameter;
                eDB mainInnerDia = pierPara.pierRebar.inner_main_reinforcement_diameter;
                string main_reinforcement_grade = pierPara.pierRebar.main_reinforcement_grade;
                string reinforcement_grade = pierPara.pierRebar.reinforcement_grade;
                string delSql = "delete from busi_engineering_quantity where  bridge_id='" + bridgeId + "' and (portable_belong_part=5 or belong_part=5) ";
                #region 数据合并
                // 数据合并
                Dictionary<eDB, List<Tuple<string, eDB, int, double, string, string>>> dic = new Dictionary<eDB, List<Tuple<string, eDB, int, double, string, string>>>();

                int divCount = 0;
                int divCountInner = 0;
                string strDiameter = "D";
                string strMainDiameter = "D";
                switch (tuLst[0].Item1.pierRebar.reinforcement_grade)
                {

                    case "HRB300":
                        strDiameter = "A";
                        break;
                    case "HRB335":
                        strDiameter = "B";
                        break;
                    case "HRB400":
                        strDiameter = "C";
                        break;
                    case "HRB500":
                        strDiameter = "D";
                        break;
                    case "HRB500E":
                        strDiameter = "D";
                        break;
                    case "HRB600E":
                        strDiameter = "E";
                        break;
                    case "HRB650E":
                        strDiameter = "F";
                        break;
                    case "HRB700":
                        strDiameter = "G";
                        break;
                    default:
                        strDiameter = "A";
                        break;
                }
                switch (tuLst[0].Item1.pierRebar.main_reinforcement_grade)
                {

                    case "HRB300":
                        strMainDiameter = "A";
                        break;
                    case "HRB335":
                        strMainDiameter = "B";
                        break;
                    case "HRB400":
                        strMainDiameter = "C";
                        break;
                    case "HRB500":
                        strMainDiameter = "D";
                        break;
                    case "HRB500E":
                        strMainDiameter = "D";
                        break;
                    case "HRB600E":
                        strMainDiameter = "E";
                        break;
                    case "HRB650E":
                        strMainDiameter = "F";
                        break;
                    case "HRB700":
                        strMainDiameter = "G";
                        break;
                    default:
                        strMainDiameter = "A";
                        break;
                }

                foreach (Tuple<PierPara, List<Tuple<string, eDB, int, double, string, string>>> item in tuLst)
                {
                    List<Tuple<string, eDB, int, double, string, string>> list = new List<Tuple<string, eDB, int, double, string, string>>();
                    for (int i = 0; i < item.Item2.Count; ++i)
                    {
                        eDB strNo = item.Item2[i].Item2;
                        if (dic.Count == 0)
                        {
                            //Tuple<string, eDB, int, double, string, string> tu = new Tuple<string, eDB, int, double, string, string>(item.Item2[i]);
                            list.Add(item.Item2[i]);
                            dic.Add(strNo, list);
                        }
                        else
                        {
                            if (!dic.ContainsKey(strNo))
                            {
                                list = new List<Tuple<string, eDB, int, double, string, string>>();
                                list.Add(item.Item2[i]);
                                dic.Add(strNo, list);
                            }
                            else
                            {
                                List<Tuple<string, eDB, int, double, string, string>> lstDB = new List<Tuple<string, eDB, int, double, string, string>>();
                                dic.TryGetValue(strNo, out lstDB);
                                //Tuple<int, Tuple<int, eDB, int, double, string>> tu = new Tuple<int, Tuple<int, eDB, int, double, string>>(item.Item3, item.Item2[i]);
                                lstDB.Add(item.Item2[i]);
                                dic[strNo] = lstDB;
                            }
                        }
                    }

                    if (item.Item1.pierRebar.main_reinforcement_diameter == item.Item1.pierRebar.inner_main_reinforcement_diameter)
                    {
                        List<Tuple<string, eDB, int, double, string, string>> tuLst0 = item.Item2.FindAll(o => o.Item6 == strMainDiameter);

                        foreach (var item0 in tuLst0)
                        {
                            divCount += ((int)(item0.Item4 * 0.01 / 12)) * item0.Item3;
                        }
                    }
                    else
                    {
                        List<Tuple<string, eDB, int, double, string, string>> tuLst0 = item.Item2.FindAll(o => o.Item6 == strMainDiameter && o.Item2 == item.Item1.pierRebar.main_reinforcement_diameter);

                        foreach (var item0 in tuLst0)
                        {
                            divCount += ((int)(item0.Item4 * 0.01 / 12)) * item0.Item3;
                        }

                        List<Tuple<string, eDB, int, double, string, string>> tuLst1 = item.Item2.FindAll(o => o.Item6 == strMainDiameter && o.Item2 == item.Item1.pierRebar.inner_main_reinforcement_diameter);

                        foreach (var item0 in tuLst1)
                        {
                            divCountInner += ((int)(item0.Item4 * 0.01 / 12)) * item0.Item3;
                        }
                    }
                }
                dic = dic.OrderByDescending(f => f.Key).ToDictionary(f => f.Key, f => f.Value);
                #endregion
                string remark = "墩身钢筋";
                string material = "钢筋";
                string materialCode = main_reinforcement_grade;
                string materielSpecs = mainDia.ToString();


                double allWeight = 0;
              
                int totalCap = 0;
                //int netCount = tuNet.Count;
                foreach (KeyValuePair<eDB, List<Tuple<string, eDB, int, double, string, string>>> pr in dic)
                {
                    string strNo = "钢筋";
                    string unit = "kg";
                    eDB diameter = eDB.None;
                    double totallength = 0;
                    // 设置表数据

                    for (int i = 0; i < pr.Value.Count; ++i)
                    {
                        // 钢筋编号
                        diameter = pr.Key;                         // 直径
                        totallength += (pr.Value[i].Item3 * pr.Value[i].Item4);

                    }
                    double weight = GlobalFuncs.GetUnitWeight(diameter);
                    double totalWeight = totallength * 0.01 * weight;

  

                    remark = "墩身钢筋";
                    material = "钢筋";
                    materialCode = main_reinforcement_grade;
                    materielSpecs = diameter.ToString();
                    if (diameter == mainDia || diameter == mainInnerDia)
                    {
                        materialCode = main_reinforcement_grade;

                    }
                    else
                        materialCode = reinforcement_grade;
                    string id = Guid.NewGuid().ToString();
                    string sql = "insert into busi_engineering_quantity(id,bridge_id,materiel,materiel_code,materiel_specs,unit,"
                        + "unit_weight,total_weight,is_auto,belong_part,portable_belong_part,remark)"
                        + "values('" + id + "','" + bridgeId + "','" + material + "','" + materialCode + "','" + materielSpecs + "','kg','"
                        + weight + "','" + allWeight + "','2','5','5','" + remark + "')";
                    sqlList.Add(sql);
                }

               
           
                material = "混凝土";
                materialCode = material;
                materielSpecs = pierPara.pierRebar.concrete_no;
                remark = "墩身混凝土";
                string id1 = Guid.NewGuid().ToString();
                string sqlIn = "insert into busi_engineering_quantity(id,bridge_id,materiel,materiel_code,materiel_specs,unit,"
                    + "total_weight,is_auto,belong_part,portable_belong_part,remark)"
                    + "values('" + id1 + "','" + bridgeId + "','" + material + "','" + materialCode + "','" + materielSpecs + "','m3','"
                    + volumTotal + "','2','5','5','" + remark + "')";
                sqlList.Add(sqlIn);

                material = "劲性骨架";
                materialCode = material;
                materielSpecs ="Q235";
                remark = "劲性骨架";
                id1 = Guid.NewGuid().ToString();
                sqlIn = "insert into busi_engineering_quantity(id,bridge_id,materiel,materiel_code,materiel_specs,unit,"
                    + "total_weight,is_auto,belong_part,portable_belong_part,remark)"
                    + "values('" + id1 + "','" + bridgeId + "','" + material + "','" + materialCode + "','" + materielSpecs + "','kg','"
                    + volumTotal * 35 + "','2','5','5','" + remark + "')";
                sqlList.Add(sqlIn);
                if (divCount > 0)
                {
                    material = "钢筋连接器";
                    materialCode = material;
                    materielSpecs = mainDia.ToString();
                    remark = "墩身钢筋连接器";
                    id1 = Guid.NewGuid().ToString();
                    sqlIn = "insert into busi_engineering_quantity(id,bridge_id,materiel,materiel_code,materiel_specs,unit,"
                        + "total_weight,is_auto,belong_part,portable_belong_part,remark)"
                        + "values('" + id1 + "','" + bridgeId + "','" + material + "','" + materialCode + "','" + materielSpecs + "','个','"
                        + divCount + "','2','5','5','" + remark + "')";
                    sqlList.Add(sqlIn);
                }

                if (divCountInner > 0)
                {
                    material = "钢筋连接器";
                    materialCode = material;
                    materielSpecs = mainInnerDia.ToString();
                    remark = "墩身钢筋连接器";
                    id1 = Guid.NewGuid().ToString();
                    sqlIn = "insert into busi_engineering_quantity(id,bridge_id,materiel,materiel_code,materiel_specs,unit,"
                        + "total_weight,is_auto,belong_part,portable_belong_part,remark)"
                        + "values('" + id1 + "','" + bridgeId + "','" + material + "','" + materialCode + "','" + materielSpecs + "','个','"
                        + divCount + "','2','5','5','" + remark + "')";
                    sqlList.Add(sqlIn);
                }
            }

        }


    }
}
